print('hello world')
I'm trying to import hello function from the interepreter while running it from folder above src:
src $ python
>> from src.test import hello
>> ModuleNotFoundError: No module named 'src.test'
How can I import it?
The goal:
I have two folders:
src/test.py
src/hello.py
test.py needs to import from hello to test with pytest
https://docs.python.org/3/reference/import.html#package-relative-imports
Wait, those aren't different folders, those are different modules
https://docs.python.org/3/tutorial/modules.html#packages
Обсуждают сегодня