Search code examples
pythonvisual-studio-codepylance

visual studio code pylance search folders


I have a project with some python in it - the python is part of a larger thing - there are several programs in several directories inside a root git - and there is some common code in yet another directory.

Running works fine - but pylance in visual studio code sees all of the dependencies as errors, even though most are in the current directory of the script I'm editing. If I open that subdirectory they work fine - but I really want to have visual code open at the larger project level.

Is there any way to bung a file somewhere in the directory that tells pylance "here is the python search path" or something?


Solution

  • You may search for settings about additional import search resolution paths:

    "python.analysis.extraPaths": [
        "path1",
        "path2",
    ],
    

    Please have a try.

    More information view Pylance Settings and Customization.