I am trying to run a test in one folder (folder A) calling a class made in a different folder (folder B), but both folders (A and B) are located in the same directory. And when I run the test file, it is giving me import errors of the class created in the folder B.
Error in Gitbash:
And you can see the directory flow
Path directory in VSCode:
CodePudding user response:
It's because the testing
folder is not in the PYTHONPATH
.
You can add your workspace folder(testing) into the PYTHONPATH
through add this in the settings.json:
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder};"
},
And then you can import accum.py
from stuff
package directly: from stuff import accum
.