If you just want to load code from a script, instead of importing
it, execfile is often a better choice. This function lets you
execute external scripts, and collect the result in a namespace
dictionary.

namespace = {}
execfile("directory/module.py", namespace)

To import all names from an imported module or a loaded namespace
into your own module, similar to from-import-*, you can do:

globals().update(vars(module))
globals().update(namespace)

To fully emulate from-import, you need to check for an
__all__ attribute, and if that’s not present, filter out
anything that starts with an underscore: