[IPython-user] reaload after from MODULE import *, and reloading nested modules

Gael Varoquaux gael.varoquaux@normalesup....
Fri Oct 24 04:59:46 CDT 2008


On Fri, Oct 24, 2008 at 11:00:14AM +0200, Maximilian Fabricius wrote:
> I am a quite happy user of iPython. Though, I encountered two issues
> concerning reloads which have been causing a bit of trouble:

> I have a little standard library called "mfutils" which I use quite
> often. So typically the first thing I do after starting ipython is

> from mfutils import *

> now, since I use it often I also modify it often and would need to
> reload it. But a "reload mfutils" does not reload the module. Actually
> since I ever did a "import  mfutils" before, "reload mfutils" even
> complains that is does not know what "mfutils" is.

Right, reload(foo) will only redifine the symbol 'foo'. The way I do this
is to use "%run foofile" where foofile is the file path to the foo
module (that you can retrieve using "print foo.__file__ ")

> Secondly, I recognized that "reload XYZ" would not reload the modules
> that are imported within XYZ. When working on code which consists of
> several modules this can lead to quite unexpected results. Is there a
> super-deep reload that would reload those as well?

dreload(XYZ), in ipython.

Gaël


More information about the IPython-user mailing list