[IPython-user] Module reload in interactive mode
Fernando Perez
fperez.net@gmail....
Tue Feb 10 19:35:28 CST 2009
Hi,
On Tue, Feb 10, 2009 at 1:54 PM, Robin <robince@gmail.com> wrote:
> Hi,
>
> On Tue, Feb 10, 2009 at 9:43 PM, Ignazio Di Napoli <neclepsio@gmail.com> wrote:
> I think the problem is the use of "from package import *" - I don't
> think you'll ever get reloading to work properly - especially if using
> that inside __init__.py (I may be wrong though).
You are completely correct in 'import *' being the source of the
problem, and it being discouraged. Having said that, there is a way
to make it work, and that is to put in your script:
import foo
reload(foo)
from foo import *
# rest of script...
In that case, if you edit foo.py and rerun the script, it will pick up
the changes correctly.
Cheers,
f
More information about the IPython-user
mailing list