Load three different modules which have the same name
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Mar 20 07:01:26 EDT 2007
En Tue, 20 Mar 2007 07:40:53 -0300, abcd <codecraig at gmail.com> escribió:
>> 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 ...
>
> 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.
Use the "as" clause when importing; it's almost the same phrase you wrote
above:
from alpha.Person import Person as Person_Alpha
or something like that.
alpha should be a package, as someone already said.
--
Gabriel Genellina
More information about the Python-list
mailing list