Here is my project folder structure
|-- root
|-- my_modules
|-- __init__.py
|-- main.py
|-- m.py
|--pipelines
|--p.py
Basically there is nothing in the __init__
and main
files of my_module
folder, I just give a simple public method in the m.py
file:
def foo():
print('foo() in m.py')
I want to import the foo
method in the p.py
in the pipelines
folder, and here is my code:
import sys
sys.path.append('..')
from my_modules import m
def p():
m.foo()
print('p')
p()
My question is, after I append the parent folder in the search path with sys.path.append
, why it still cannot find my_mofules
? How can I fix this problem?