[Tutor] IDLE not getting changes to imported module
Wed Apr 23 15:45:02 2003
Content-Type: text/plain; x-avg-checked=avg-ok-58B519DC; charset=us-ascii; format=flowed
At 11:42 AM 4/23/2003 -0700, Zak Arntson wrote:
>I've got a simple problem, which I'm sure has been answered, but I
>couldn't find the answer at the Tutor archives. I'll pose the problem as a
>"bug report" :)
>Problem: IDLE not picking up changes to an imported module
>1. A module, main.py, imports another module, thing.py
>2. From main.py, I "import module" then "run script"
>-- Things work fine --
>3. Change and save thing.py
>4. From main.py, I "run script"
>Expected: Changes made in thing.py are picked up and reflected in step 4.
>Actual: Changes made in thing.py are NOT picked up, and the original,
>unchanged version of thing.py is used.
>I'm guessing that the original thing.py is stuck in memory, and not
>updated when main.py imports again (with the second "run script"). The
>only fix I've found so far is to restart IDLE everytime I want to run any
>changes to an imported module. But that seems pretty clunky.
>Is there some way I can get thing.py's changes to be reflected as soon as
>I save it?
After the initial import (I'm assuming it is "import thing") use the reload
function to capture changes:
303 442 2625
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-58B519DC
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.474 / Virus Database: 272 - Release Date: 4/18/2003