This is my directory structure.
PyCharm
Python
PRD
_AppFunc
DbUtils.py
__init__.py
_AppCode
DataExtract.py
__init__.py
__init__.py
__init__.py
And my PYTHONPATH is set to C:\Users\username\Desktop\PyCharm\Python\PRD
In DataExtract.py I am trying to import DbUtils.py using
from .._AppFunc import DbUtils
And getting this error...
Traceback (most recent call last):
File "C:\Users\username\Desktop\PyCharm\Python\PRD\_AppCode\DataExtract.py", line 36, in <module> from .._AppFunc import DbUtils
ValueError: Attempted relative import in non-package
If I move DBUtils.py out of _AppFunc folder and under PRD, it works fine. But I intend to keep it in a separate folder to restrict access.
I have read most stack overflow threads related to this and python doc on intra-package-references but couldn't get it to run.
How do I go about it !?