I have the following folder structure:
A/fold1/MyLib/package/
in which I have an __init__.py
file and a file with the functions I need, let's call it file.py
.
When I work from this path:
A/fold1/myProject/script.py
I try to import it but it looks like this library can't be found.
I have already worked, and it was fine when I had a structure like this:
A/fold1/myProject/package/file.py
where package
contained also the __init__.py
file.
I also got suggestions from the Spyder IDE. What I used, to make it work was to import like this:
if packagePath not in sys.path:
sys.path.append(packagePath)
import package.file as f
But currently it doesn't work, and I don't even get the suggestions from the Spyder IDE.
Is there a way to import from the specified structure?
I wanted a folder with all my functions, and if possible to have it in this folder and not between the hundreds of libraries of python.
Thanks!