Jul-31-2024, 09:08 AM
Hi
It's a naive question to find the correct synthax (all i tested failed):
Context: In
If all files are located in the current directory (traditional situation):
Now i move-up "MyFile1.py" into the upper directory:
Then I call the module
What I'm missing (it supposed to be quite simple)?
Thanks
It's a naive question to find the correct synthax (all i tested failed):
Context: In
MyFile1.py
, i want to load the function1 and function2.If all files are located in the current directory (traditional situation):
1 |
from MyFile1 import function1, function2 |
1 |
from ..MyFile1 import function1, function2 |
Error:ImportError: attempted relative import with no known parent package
Same error if i create a module:MyModule.py
1 |
from MyFile1 import function1, function2 |
1 |
from ..MyModule import function1, function2 |
Thanks