For the following Python code:
first.py
# first.py
from second import Second
class First:
def __init__(self):
print 'Second'
second.py
# second.py
from first import First
class Second:
def __init__(self):
print 'Second'
After creating the files and running the following from the shell:
python first.py
I get the error: ImportError: cannot import name Second
Do other dynamic languages like Ruby have this kind of issue? The reason I'm asking is because I'm encountering this issue in a Django project where 2 models depend on each other. I know that the possible solutions are re-designing the project or import on demand. I just want to know if devs in other dynamic languages have experienced this issue.