I’m trying to use a class from other folder.
I created an __init__.py
file in all my folders. But I sill can’t import the class.
I’m trying to import Vector class from ex02/vector,py to ex03/matrix.py
Here is the tree file
day01
.
├── README.md
├── __init__.py
├── ex00
│ ├── __init__.py
│ ├── book.py
│ ├── recipe.py
│ └── test.py
├── ex01
│ ├── __init__.py
│ └── game.py
├── ex02
│ ├── __init__.py
│ ├── pytest.py
│ └── vector.py
└── ex03
├── __init__.py
└── matrix.py
I’m importing using this command:
from day01.ex02.vector import Vector
But I’m getting this error:
Traceback (most recent call last):
File "matrix.py", line 1, in <module>
from day01.ex02.vector import Vector
ModuleNotFoundError: No module named 'day01'
The python code that is importing is this one:
And the one that I'm trying to import is this one