I'm trying to write tests for my project in a different folder named tests
like most opensrc projects. But I always get module not found
This is how my project looks:
.
├── __init__.py
├── src
│ ├── func.py
│ └── __init___.py
└── tests
├── __init__.py
└── test_func.py
Here is my code in test_func.py
from src.func import function
function()
When i run this in pycharm, it runs flawlessly. But when i try editors like vscode or even a normal terminal i get:
ModuleNotFoundError: No module named 'src'
I tried to execute test_func.py
from the project directory as well as other subfolders. I just get that error every time. I'm sure this is not good behavior since my code cant run on my friends computer.
How do i fix it? I've read and seen a lot of import tutorials but could not find a way to fix the problem
Any help is appreciated thanks