I have a file structure like this:
My_Package/
__init__.py
helper_fun.py
sub_dir_1/
__init__.py
codes.py
I want to import functions from helper_fun.py
while inside codes.py
. I tried
from helper_fun import foo
from .helper_fun import foo
from ..helper_fun import foo
from My_package.helper_fun import foo
but none works. How should I use absolute import to always specify import directories from the top-level My_Package
?