Python Embedding Importing relative modules

moerchendiser2k3 googler.1.webmaster at spamgourmet.com
Tue Jul 6 14:50:21 EDT 2010


>Set sys.path to include each script's base dir before running it, then
>restore after each script.

That works, but doesnt solve the problem.

ScriptA.py has a module in its directory called 'bar.py'
ScriptB.py has a module in its directory called 'bar.py'

Imagine the 'bar.py' modules dont have the same content, so
they are not equal.

Now when the first bar.py is imported, the second import for
a "import bar" imports the first one, because its already
stored in sys.modules.



More information about the Python-list mailing list