Load three different modules which have the same name

Steve Holden steve at holdenweb.com
Tue Mar 20 07:37:21 EDT 2007


abcd wrote:
>> Blerch! Why not just call the modules by the right names in the first
>> place? Then each will have its own sys.modules entry for a start ...
>>
>> regards
>>   Steve
> 
> what do i need to do?  also, is there a way I can load each one as I
> have but each one have its own unique entry in sys.modules?  For
> example i could load Person from Person (in alpha) as, "Person_Alpha"
> or something like that in sys.modules?  not sure how I might do that.
> 
> Thanks!
> 
The easiest way to proceed is simply to call the .py files by different 
names - then they automatically get theor own sys.modules entry.

[sys.modules is a dictionary where you can look modules up by name. it's 
helpful to ensure each module gets its own entry, and the presence of 
the entry is how the system avoids unnecessary reloading of modules].

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list