Here is how you can solve this issue:
Make sure you selected the right python interpreter for your project (in case you are using virtualenv/pipenv/other):
When you run pipenv shell
, you will see which python interpreter is used. A folder named .vscode
will be created once you select a different interpreter than the default one. Inside .vscode
you will have a settings.json
file.
In settings.json
file you have to add the paths from which you import what's needed in extraPaths
:
{
"python.pythonPath": "/home/youruser/.virtualenvs/app-FzQGSFjf/bin/python",
"python.analysis.extraPaths": ["app", "another/path/etc"]
}
In my case, app
folder was not known by Pylance.