Search code examples
pythonvisual-studio-codepylance

Pylance underlines import as error but it works?


import workspace2

workspace2.a_func()

This works and runs completely fine, however it underlines workspace2 as unresolved and leaves the function un-coloured.

underlined

error


Solution

  • Add

    "python.analysis.extraPaths": ["${workspaceFolder}/python"],

    in the settings.json file.

    You can refer to here for more detail