Ich habe zwei Python-Modulen:Attribute: 'Modul' Objekt hat kein 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"
Als ich a.py
laufen, erhalte ich:
AttributeError: 'module' object has no attribute 'hi'
Was doe s der Fehler bedeutet? Wie repariere ich es?
Dies ist ein schreckliches Design. Warum importiert b.py a, wenn es keinen Teil von a.py referenziert? Fragen Sie, wie Sie dieses Problem beheben können? http://stackoverflow.com/search?q=%5Bpython%5D+circular+dependency –
Beachten Sie, dass Ihre Fragen dieser Antwort sehr ähnlich sind. Anscheinend funktioniert der Code in dieser Antwort nur, aber deiner nicht? http://Stackoverflow.com/a/7336880/565879 – Buttons840