can I import the module twice (under differnet names)

Steve Holden steve at holdenweb.com
Thu Nov 2 07:53:09 EST 2006


alf wrote:
> Hi,
> 
> wonder if in the python I could treat modules imorts like classes 
> instances. It means I could import it twice or more times under 
> different names.
> 
If you want to repeat the full import, and have each imported version 
get an independent namespace as well as independent code objects and so 
on then you will have to somehow persuade the interpreter that they come 
from different files, I believe.

If you just want to be able to use several names to refer to the same 
module then you have already had a coupe of good answers.

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




More information about the Python-list mailing list