Amir Dekel wrote:
Mike Meyer wrote:


Doing a second import will find the module in sys.modules and not bother looking in the file system. The solution is to reload(module) instead of import module.

<mike

What if I import using "from module import class"? It seems to me that I can't use reload then, or I just couldn't find the right syntax...

Correct. Using a non-from import is actually easier when experimenting, since reload is easier to use.


If you have used a from-style import, you have to do this to force a reload of the relevant class:

Py> from module import x
Py> # Do stuff
Py> import module
Py> reload(module)
Py> from module import x
Py> # We now have the updated version of x

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to