I am trying to do an import in python from one directory level up.
import sys
sys.path.append(\'..\')
from cn_modules import exception
I g
Since this is a VScode question I could add what my answer was.
We are running many Python Django backends in a backends folder like so:
+projectBackends
-oneService
-twoService
-threeService
And so in my project folder in VScode I just opened the projectBackends folder, because this would then give me all the services underneath it all at once. Seemed clear and simple. But then all the linting gets done from the root folder which is projectBackends, and not from the root folder of each service:
from oneService.module1 import view
gave and import error, where if I put
from projectBackends.oneService.module1 import view
I got no error, but then the microservice would not work.
So in the end I just added a folder for every microservice in my workspace like:
+oneService
+twoService
+threeService
Which solved all the import errors for the independant microservices