Circular Import in Python
·2 mins
Recently, I found a really good example code for Python circular import, and I’d like to record it here.
Here is the code:
1 2 3 4 5 6 7 8 # X.py def X1(): return "x1" from Y import Y2 def X2(): return "x2" 1 2 3 4 5 6 7 8 # Y.