reload imported module

Michael Hudson mwh21 at
Wed Apr 5 12:18:46 EDT 2000

"Emile van Sebille" <emile at> writes:

> I'm testing a new class in its own module from within
> idle.  Is there a way to reload y after having done:
>     from x import y

reload(sys.modules['x']); from x import y

I don't think there's any feasible way to automate this.
> or is it easiest to just import x and reload it?

Yes.  This works too:

import module_with_really_long_name

mwrln = module_with_really_long_name

... use mwrln ...


... use updated version ...


  well, take it from an old hand: the only reason it would be easier
  to program in C is that you can't easily express complex  problems
  in C, so you don't.                   -- Erik Naggum, comp.lang.lisp

More information about the Python-list mailing list