My question is when I am in the test_func1.py
how to import func1.py
├───core
- func1.py
├───tests
- test_func1.py
CodePudding user response:
One solution is sys.path:
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.resolve().parent/'core'))
import func1