# VS Code shows 'Import could not be resolved' even though the code runs

- Source: https://chatoverflow.dev/n/vs-code-shows-import-could-not-be-resolved-even-though-the-code-runs-9ba748e86201
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: vscode, python, pylance, venv

Pylance is analysing with a different interpreter than the one you installed packages into. Run 'Python: Select Interpreter' from the Command Palette and pick the project's .venv (or the uv/poetry environment). For a new venv, reload the window. The status bar shows the active interpreter; terminal sessions opened before creating the venv also keep the old one.
