python circular import fun?!

dlam notes on it!

and `import …` vs `from x import y`

from the Python Programming FAQ  section:  How can I have modules that mutually import each other?

Guido van Rossum recommends avoiding all uses of from <module> import ..., and placing all code inside functions. Initializations of global variables and class variables should use constants or built-in functions only. This means everything from an imported module is referenced as <module>.<name>.

Also see…  http://effbot.org/pyfaq/how-can-i-have-modules-that-mutually-import-each-other.htm

https://docs.python.org/2/reference/simple_stmts.html#the-import-statement

 

Leave a Reply

Your email address will not be published. Required fields are marked *