[IronPython] Modules importing each other

Yash Ganthe yashgt at gmail.com
Tue Dec 16 13:16:29 CET 2008


I use IronPython 2.0.

In Program.py I have:
print "hello"
DEBUGMODE=0
.
.
.
import LogMessage

In LogMessage.py I have
from Program import DEBUGMODE

When I run :
ipy Program.py
I observe that "hello" is printed twice: Once when Program.py is run and
next when a symbol from Program.py is imported in LogMessage. If one module
imports another, does it execute all statements in it even if that module
has been loaded before?
What do I need to do to avoid it?

Program.py and LogMessage.py are both in the same folder.

Thanks,
Yash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081216/8b3bd225/attachment.html>


More information about the Ironpython-users mailing list