Christophe wrote: > > "import" only reads the file the first time it's called. Every import > > call after that looks up the module in memory. This is to prevent > > circular dependencies between modules from creating infinite loops. > > You need to use the reload() function: > > As a matter of fact, it would help a lot if that stupid behaviour of > Idle was dropped. I'm sure I'm not the only one who lost lots of time > because of that bug. Yes I call it a bug.
in the version of IDLE I have on this machine, if I modify my script and run it again (using F5), things work exactly as expected. if I modify my script and import it into a clean shell (ctrl-F6), things work exactly as expected. the only way to get the "buggy" behaviour you're describing is to attempt to run your program by importing it as a module more than once into an existing python shell process. in that case, import works in the same way as it always works. after all, "import" isn't designed to run programs, it's designed to import modules. if you want to run stuff in IDLE, why not just use the "run" command ? </F> -- http://mail.python.org/mailman/listinfo/python-list