[IPython-user] Fail to reload file on %run

Ville Vainio vivainio at gmail.com
Thu Jun 22 02:36:17 CDT 2006

On 21 Jun 2006 23:37:42 +0200, Joachim B Haga <cjhaga at fys.uio.no> wrote:

> To follow up on this: It fails to reload when the file (PmtReader.py)
> looks like this,
>   ----------------------
>   class PmtReader:
>       ...snip...
>   if __name__ == "__main__":
>       import PmtReader
>       p = PmtReader.PmtReader('ggxy')
>   ----------------------

Do you really mean you don't import the module you are inside currently?

> but it works if the "import" etc is removed,

When you %run something, the modules it imports are not reloaded, but
the already loaded version is used. Try reload():ing the modules the
%run-ed file imports (and you have modified). %run doesn't do this

Does this help, or am I misunderstanding something?

Ville Vainio - vivainio.googlepages.com
vainio.blogspot.com - g[mail | talk]='vivainio'

More information about the IPython-user mailing list