I am trying to debug in Visual Studio Code a simple python program that imports a module from a different directory. It keeps giving me ModuleNotFoundError.
in /script/myProg.py, I am calling a function that resides in /lib/hello.py. It runs fine but when I debug it, it raises exception.
Sorry I can't post images directly in the questions yet, but I have screen capped everything below:
I added the below code before the import and it's working.
import sys sys.path.insert(0,'')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.