> Am I understanding correctly that if you have a module foo importing wx > and a module main importing both foo and wx there are actually two > instances of wx created, one referenced to by (at top level) foo.wx.* > and one wx.*? If this is indeed the case it isn't too good for the > performance doing this importing of wx multiple times right? >
No, they aren't two instances. The first import will evaluate the wx-module (there could be code in there executed upon importing it). All subsequent imports of that module will only bind the already imported module to the name. So - the way to have one module be available in several other modules is to import them in each of them - causing actually close to none overhead, as the import statement is evaluated only once per file (unless you put it in a loop or something, but this still only would return the same reference.) Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list