I have a folder, which contains two separate folders, one of which holds some python modules, and the other one holds a python script that uses those modules:
parentFolder/
lib/
__init__.py
readFile.py
writeFile.py
folder/
run.py
The __init__.py
file is empty. In run.py
, I have the following:
from ..lib import readFile
data = readFile('file.dat')
This gives me the error
Traceback (most recent call last):
File "run.py", line 1, in <module>
from ..lib import readFile
ValueError: Attempted relative import in non-package
What am I missing?