Importing two modules of same name
dieter at handshake.de
Wed Feb 10 02:54:42 EST 2016
Carl Meyer <carl at oddbird.net> writes:
> If you omit the future-import in Python 2.7, `import config` will import
> the neighboring app/config.py by default, and there is no way to import
> the top-level config.py.
There is the "__import__" builtin function which allows to specify
the "parent package" indirectly via its "globals" parameter. This
way, you can import the "top-level" config (passing an empty "globals").
More information about the Python-list