circular imports
qhfgva at gmail.com
qhfgva at gmail.com
Fri May 20 13:10:06 EDT 2005
All of the __init__.py files are empty and I don't know of any
overlapping of names. Like I said this is code that works fine, I'm
just trying to clean up some things as I go. Here are my working
examples:
x1.py
======
# how things work in our code now:
# called with home/dlee/test/module python aaa/x1.py
import sys
sys.path.append('/home/dlee/test/module')
import x2
def goo():
print 'hi from goo'
if __name__ == '__main__':
x2.foo()
x2.py
======
import sys
sys.path.append('/home/dlee/test/module')
import x1
def foo():
print 'entered foo'
x1.goo()
y1.py
======
# this works but is not quite what I want
# called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python
aaa/y1.py"
import aaa.y2
def goo():
print 'hi from goo'
if __name__ == '__main__':
aaa.y2.foo()
y2.py
======
import aaa.y1
def foo():
print 'entered foo'
aaa.y1.goo()
z1.py
======
# how I'd like things to work, but is failing for me
# called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python
aaa/z1.py"
from aaa import z2
def goo():
print 'hi from goo'
if __name__ == '__main__':
z2.foo()
z2.py
======
om aaa import z1
def foo():
print 'entered foo'
z1.goo()
w1.py
======
# this would also be acceptible
# called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python
aaa/w1.py"
import aaa.w2 as w2
def goo():
print 'hi from goo'
if __name__ == '__main__':
w2.foo()
w2.py
======
import aaa.w1 as w1
def foo():
print 'entered foo'
w1.goo()
More information about the Python-list
mailing list