I had already read other threads like this one an this other one, but I could not get an answer. I created a package with the following structure:
my_package (folder)
__init__.py
my_folder (folder)
__init__.py
my_file.py (contains f1 and f2 functions)
my_other_folder (folder)
__init__.py
my_other_file.py (contains of1, of2, of3 functions)
at the beginning of my_other_file.py, I had put the import statements:
from ..my_file import f1
from ..my_file import f2
Inside of1 function, I cannnot call f1 directly, I need to call f1 as my_file.f1 (that's ok). On the other side, of2 function is a "shell" calling the function of of3 with a function parameter that, depending on the conditions, can be either my_file.f1 or my_file.f2. In other words, the code of function of2 is:
def of2:
if ....:
result = of3(my_file.f1)
if ....:
result = of3(my_file.f2)
return result
the code above is is not working. However, if I use the below (without my_file), everything is ok:
def of2:
if ....:
result = of3(f1)
if ....:
result = of3(f2)
return result
Why I need to call the same function once f1 and another time my_file.f1? Am I doing something wrong?