Set the working directory In launch.json, specify a dynamic working directory (i.e. the directory where the currently-open Python file is located) using: "cwd": "${fileDirname}"