Problem with modules reloading

DSblizzard dsblizzard at gmail.com
Thu Mar 4 21:10:59 EST 2010


I have had already following question:
"How to use *.py modules instead of *.pyc?"

Last time I when asked that question I resolved problem by using one
big .py file. And answers doesn't work in my case. Now I ought to use
several files and almost the same problem arises again. Admit I have 2
modules: m2.py and m1.py

in m2.py:
from m1.py import *

def foo2():
  foo1()

foo2()

in m1.py:

# empty

After copying m2.py contents directly to python.exe:
"NameError: global name 'foo1' is not defined"

Then I define foo1 in m1 and copy following lines to python.exe:
from m1.py import *
foo2()

Nothing changes, the same error, and .pyc files, if I have deleted
them doesn't created again.

What is the solution?



More information about the Python-list mailing list