Is it possible to reload a module from a different file?

ilochab ilochab at yahoo.it
Wed Mar 12 08:00:52 EDT 2008


I mean ...

The main module makes this import:


import moduleX


later other modules make different import to an other module named 
moduleX like this:


from pack.subdir  import moduleX


What I want is that the second import of moduleX in some way must be 
redirected onto the first one.

Is there any way to do so?

Would there be any way to do so (moduleX overrides pack.subdir.moduleX) 
if they were imported on reverse order?


Any time I discover that Python can do amazing things, but perhaps this 
one is just a silly one, isn't it?

ciao
Licia



More information about the Python-list mailing list