I don't find the mistake in the code nor in the call when trying an import test.
My directory structure is the following: (from /home/user1/python_test/)
main.py
Aux/lib1.py
Aux/__init__.py
main.py:
from Aux.lib1 import fun_A
if __name__ == "__main__":
fun_A()
print("all done")
Aux/lib1.py:
def fun_A():
print("A function called")
I'm executing from terminal (python main.py from directory where main.py is), maybe is there a need to set pythonpath? I don't recall the need before, I've made some python programs like these some time ago (2/3 years)
I have also tried from .Aux.lib1 import fun_A instead of from Aux.lib1 import fun_A but nothing works. The error is:
File "main.py", line 1, in <module>
from Aux.lib1 import fun_A
ImportError: No module named Aux.lib1
os.getcwd()This will show you what is the current directory you are running this code. and useos.chdir('/home/user1/python_test/')To change itos.getcwd()outputs/home/user1/python_test/