Skip to content Skip to sidebar Skip to footer

Simple Case Of __init__.py And Import Giving Mysterious Module Not Found

I've tried this from so many different angles but can't sort it out. Must be such a simple case. In Python 3.7.6: Directory structure: ./modtest/ ./modtest/__init__.py ./modtest/t

Solution 1:

You are importing modtest in test1.py while this module itself resides inside of modtest. This can't be because modest wouldn't have yet been defined and added to the search path. So this is what you should have actually:

./modtest/
./modtest/__init__.py
./modtest/
./modtest/test2.py
./test1.py  # this module must be outside of modtest

Post a Comment for "Simple Case Of __init__.py And Import Giving Mysterious Module Not Found"