Class changes in circular imports when __name__ == '__main__'

Dave Angel davea at
Tue Sep 7 01:44:17 CEST 2010

On 2:59 PM, Carl Banks wrote:
> On Sep 5, 5:07 pm, Dave Angel<da... at>  wrote:
>> On 2:59 PM, Carl Banks wrote:
>>> All of this gets a lot more complicated when packages are involved.
>> Perhaps a better answer would be to import __main__ from the second module.
> Then what if the module is imported from a different script?  It'll
> try to import __main__ but get a different script than expected.
Then the module needs to adjust its expectations.  The point is it 
should never try to import the script by name.


More information about the Python-list mailing list