[Tutor] reloading all modules?
Don Arnold" <firstname.lastname@example.org
Tue Apr 29 22:58:01 2003
----- Original Message -----
From: "Magnus Lyckå" <email@example.com>
To: "Zak Arntson" <firstname.lastname@example.org>; <email@example.com>
Sent: Tuesday, April 29, 2003 9:28 PM
Subject: Re: [Tutor] reloading all modules?
> At 18:09 2003-04-29 -0700, Zak Arntson wrote:
> >I'm working on a project in IDLE, and I often modify several modules at
> >once. When I change a module, I've got to save it and reload () it. This
> >can be a pain with reloading 3 modules every time I want to rerun my
> >Is there a way to reload all imported modules in memory? Or del them all?
> In IDLE? Don't think so...
> My suggestion is to just edit filed in IDLE (or PythonWin or
> whatever) and then run them from the command line. Then you
> get a fresh start every time, and your running program isn't
> "disturbed" by all the modules in IDLE etc. Printing will be
> much faster, there are no problem with GUI event loops messing
> things up for each other--as well as the load problem.
> I guess using an IDE which always run the code in a separate
> process helps. Try IDLE-fork for the most convenient way to
> get that feature.
> Magnus Lycka (It's really Lyckå), firstname.lastname@example.org
> Thinkware AB, Sweden, www.thinkware.se
> I code Python ~ The shortest path from thought to working program
What I've done before instead of using a plain vanilla import in my modules
is wrapping the reload in a try block and importing on the exception:
Of course, if you're working directly from the interpreter prompt, it's
admittedly not too useful.