1
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

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Quack
  • 133
  • 7
  • 1
    Does this answer your question? [Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports) in VS Code using python 3.x on Ubuntu 20.04 LTS](https://stackoverflow.com/questions/65252074/import-path-to-own-script-could-not-be-resolved-pylance-reportmissingimports) – Gino Mempin May 30 '21 at 23:30

2 Answers2

2

Add

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

in the settings.json file.

You can refer to here for more detail

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
0

I solved it by realizing i had two versions of Python 3 installed. I uninstalled the older version and now it can find the directories for any modules perfectly well.

You can check your python versions in windows by opening Command Prompt and typing py -0 Then uninstalling from contorl panel.

Quack
  • 133
  • 7