[Tutor] Help IDLE Compile Problem

Bob Gailer bgailer at alum.rpi.edu
Tue Jul 11 22:18:04 CEST 2006


Bugra Cakir wrote:
> Hi,
>
> I have two Python source files within editing them via IDLE.
> I have a problem. The second file is used by the first file. Some parts
> i mean from the second file is used. But when i change the contents of 
> the
> second file and while i'm running the first file with F5, change 
> doesnt reflect
> to the runtime. If i close two IDLE windows and delete .pyc of the 
> second file
> then it is ok. What is the problem ?
Your question is hard to address because we don't know what you mean by 
"The second file is used by the first file". I will assume you are 
importing it. Import runs the imported module once. Subsequent 
executions of import do NOT rerun the module. Therefore any changes you 
make to it are not showing up. To work around this "problem", after 
importing, use the reload function:
import foo
reload(foo)

-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list