Is this right? Multiple imports of same module.

Lou Pecora pecora at anvil.nrl.navy.mil
Fri Mar 9 09:30:46 EST 2007


>From what I gleaned on some messages this is the way multiple imports of 
the same module work.  Say, I have 3 modules (mod1.py, mod2.py, and 
mod3.py) and in the same session they all import another module 
mymodule.py like this:

*In mod1.py

import mymodule

*In mod2.py

import mymodule

*In mod3.py

import mymodule as MM

Then mymodule is imported only once, but each module has access to it 
through the module name (mod1 and mod2) and the alias MM (mod3).  Is 
that right?

I was concerned about multiple imports and efficiency.

Thanks for any info.

-- Lou Pecora  (my views are my own) REMOVE THIS to email me.



More information about the Python-list mailing list