Pylint "unresolved import" error in Visual Studio Code

Solution 1:

The accepted answer won't fix the error when importing own modules.

Use the following setting in your workspace settings .vscode/settings.json:

"python.autoComplete.extraPaths": ["./path-to-your-code"],

Reference: Troubleshooting, Unresolved import warnings

Solution 2:

In your workspace settings, you can set your Python path like this:

{
    "python.defaultInterpreterPath": "/path/to/your/venv/bin/python",
}

Solution 3:

Alternative way: use the command interface!

Cmd/Ctrl + Shift + PPython: Select Interpreter → choose the one with the packages you look for:

Enter image description here