Module loading trickery
davea at ieee.org
Wed Oct 6 04:36:58 CEST 2010
On 2:59 PM, Thomas Jollans wrote:
> % cat a.py
> foo = 'Meh.'
> import b
> % cat b.py
> from a import foo
> % python a.py
But there are now two modules containing separate items foo, one is
called __main__, and the other is called a.
The former is the script you ran, and the latter is the module imported
by b. Several problems could occur, including if foo were a list, and b
appended to it, the original script wouldn't see the change.
More information about the Python-list