F12 VSCode (Go To Definition) pointing to the wrong module


I have a scenario with a Python project that has 2 similar modules (same name and same structure).

I make sure that the PYTHONPATH has the right order of imports so that it has the behavior I expect.
But the F12 Go To Definition function within VSCode does not follow that pattern and goes to the definition in the wrong module/folder.

How can I make sure GTD follows the order in the PYTHONPATH? Or at least force it to go to the folder I want?

Asked By: othymomo



For future reference – thanks to user for the comment – setting the below variables in my settings.json helped solve the issue:

"python.autoComplete.extraPaths": [your_folder],
"python.analysis.extraPaths": [your_folder],
"python.analysis.include": [your_folder],
"python.analysis.exclude": [some_other_folder],
Answered By: othymomo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.