J'ai deux modules Python:AttributeError: objet 'module' n'a pas d'attribut
a.py
import b
def hello():
print "hello"
print "a.py"
print hello()
print b.hi()
b.py
import a
def hi():
print "hi"
Quand je lance a.py
, je reçois:
AttributeError: 'module' object has no attribute 'hi'
s l'erreur signifie-t-elle? Comment je le répare?
C'est un design horrible. Pourquoi b.py importe-t-il un quand il ne référence aucune partie d'a.py? Demandez-vous comment résoudre ce problème? http://stackoverflow.com/search?q=%5Bpython%5D+circular+dependency –
Notez que vos questions sont très similaires à cette réponse. Apparemment, le code de cette réponse fonctionne, mais pas le vôtre? http://stackoverflow.com/a/7336880/565879 – Buttons840