'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS 'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS python-3.x python-3.x

'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS


Pylance, by default, includes the root path of your workspace. If you want to include other subdirectories as import resolution paths, you can add them using the python.analysis.extraPaths setting for the workspace.

  • In VS Code press <ctrl> + <,> to open Settings.
  • Type in python.analysis.extraPaths
  • Select "Add Item"
  • Type in the path to your library /home/andylu/Dokumente/Allgemeines_material/Sonstiges/Programming/Python/Scripts/


Two methods below:

  1. In VS code you can edit the setting.json file. If you add "python.analysis.useImportHeuristic": true the linting error will be removed.

  2. The alternative is to add # type: ignore at the end of the import code.

Here is the github link that i got the above resolution from: https://github.com/microsoft/pylance-release/issues/68

It worked for me: python 3.9, VScode, windows10