3 ms·
Regarding circular imports and #7: The main problem in arises when using the from mymodule import mysymbol notion. The example solved this by properly using im
by udioron 12y ago
Regarding circular imports and #7:
The main problem in arises when using the from mymodule import mysymbol notion.
The example solved this by properly using import mymodule, although this might cause some more problem if your design is wrong, as see in the example. Calling f() from the module ("library") code itself is a very bad idea. Instead one should do this:
a.py:
import b
def f():
return b.x
b.py:
import a
x = 1
def g():
print a.f()
main.py:
import a
a.f()