Module trouble [newbie]

Boris Ozegovic silovana.vjeverica at com.gmail
Fri Feb 23 09:12:47 EST 2007


Diez B. Roggisch wrote:

> I use it sometimes myself, to avoid otherwise circular imports. 

Circular imports are the reason why I have module issues.  Last question:
if I put modules in some package and then try to import one I get
"AttributeError: 'module' object has no attribute 'a'

Code is:

a.py
A = 756
import someFolder.b as b
print "A printing"
print "B is %s" % b.B

b.py
B = 2000
import someFolder.a as a
print "B printing"
print "A is %s" % a.A

How can I do circular imports if I use packages?  Darn.  I don't remeber
this module gothcas when reading Learning Python.

-- 
http://www.nacional.hr/articles/view/23894/23



More information about the Python-list mailing list