my_project
-my_project
- __init__.py
- main.py
- constants.py
-test
- __init__.py
- test_main.py
test_main.py from my_project import main
main.py import constants
When I run nosetests in my_project, I end up getting ImportError: No module named 'constants'
Both __init__.py files are blank.
If I change import constants to from my_project import constants in main.py, nosetests work. However, now if I just run python main.py I get ImportError: No module named 'my_project'.
Can someone help me point out what I'm doing wrong? I've searched quite a few posts but I haven't been able to fix it myself. Thanks.