2.1.1 global weirds

Alex Martelli aleaxit at yahoo.com
Sat Aug 11 07:39:43 EDT 2001


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
news:FkggeoAAfQd7Ewfb at jessikat.fsnet.co.uk...
    ...
> why is b2.getStory not getStory? Is it because importing from a isn't
> the same as the importing from the __main__ module?

Exactly.  You have two instances of the module, one referred
to by sys.modules['__main__'] and the other by sys.modules['a'].


> What is the correct way to import from the main script?

import __main__


Alex






More information about the Python-list mailing list