[Python script error] AttributeError: 'module' yyy 'has no attribute' xxx 'solution

Reference to this record probably understand the reason,

Further in-depth understanding of the import mechanism in python,

Found each other import your own modules.

For example, A.py the import B, but also B.py the import A,

Now execution modules A, code B will first move over, but there Import B A, but this time A.pyc not generate, so the code after the import A and B can not be performed;

If the attribute xxx mode B is defined after import A, the title of that error occurs;

(The python is an interpreted language, the code before it is A or import can be produced A.pyc, it may be necessary to import into position A)

Guess you like

Origin www.cnblogs.com/peanutk/p/11563415.html