[IPython-user] Module reload in interactive mode

Ignazio Di Napoli neclepsio@gmail....
Thu Feb 12 17:44:09 CST 2009


Thank you all! It works replacing all the "from ... import *" in the
__init__.py files.
Thank you very much,
Ignazio

On Wed, Feb 11, 2009 at 2:35 AM, Fernando Perez <fperez.net@gmail.com> wrote:
> 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