My file structure looks like this
.
├── app.py
└── tests
├── Test.py
├── Test0.py
└── __init__.py
This is app.py:
import tests.Test
This is Test.py
import Test0
What is in Test0.py
is irrelevant. Let's just say it contains nothing. __init__.py
is also empty.
When I run the command python3 app.py
, I get the error:
ModuleNotFoundError: No module named 'Test0'
This is strange since if I change Test.py to:
from . import Test0
it all works perfectly; no errors.
I cannot understand why. I thought simply using import x
would attempt to import a module named x
either locally or from the standard lib.
Can somebody explain this behaviour to me? Additionally if there is a way to simply import just using import Test0
please tell me.
Python sandbox replicating issue: https://repl.it/repls/FirsthandQuickBytecode