Exception has occurred: ModuleNotFoundError No module named 'src'

I am facing this problem while my "from src.simulation.simulator import Simulator" is in the same directory. what should i do now to resolve this problem?

I have tried to solve this problem but did not understand what to do!!

Upvotes: 0

Views: 373

Answers (1)

MingJie-MSFT
MingJie-MSFT

Reputation: 9209

Since you haven't updated for a long time, I have made a guess.

This maybe caused by vscode using workspace as root floder.

This will lead to a problem. When you use the os.getcwd() method in the deep directory of the workspace, you will still get the workspace directory.

You can open your settings and search Python > Terminal: Execute In File Dir then check it.

enter image description here

You can also use debug mode and add the following to your launch.json:

"cwd": "${fileDirname}"

Upvotes: 0

Related Questions