"python.analysis.extraPaths": ["./.venv/lib/python3.x/site-packages"] Use code with caution.

Run the following command in your terminal to get the paths Poetry is using: poetry env info Use code with caution.

For your own code modules to be recognized, every directory that is a Python package contain an __init__.py file (which can be empty). Without this, Python (and Pylance) may not treat the directory as a package, leading to "unresolved import" errors.

Why it happens (concise)

But instead of sleek autocomplete, you see a squiggly yellow line. You hover over it.

This tells Pylance to hard-target that folder when resolving import statements, clearing up any residual linting errors. Still Seeing Errors? Try This Troubleshooting Checklist

The cleanest, most reliable way to prevent Pylance discovery issues across all your projects is to force Poetry to install virtual environments directly inside your project folder as a .venv directory. VS Code detects in-project virtual environments automatically. Execute the following commands in your terminal:

If you don't see it, select "Enter interpreter path..." and point to the bin/python (Linux/macOS) or Scripts/python.exe (Windows) inside your poetry environment. 2. Configure Poetry to Create Virtual Envs Inside Projects

poetry env info --path

This is by far the most common root cause of the issue. You must manually tell VS Code which Python interpreter to use.

For example, on macOS, you would set it to: ~/Library/Caches/pypoetry/virtualenvs

The most important elements here are python.defaultInterpreterPath for permanent interpreter selection and python.analysis.extraPaths to help Pylance find all your local source code.

Run this command in your terminal to force Poetry to create a .venv folder in your project root: poetry config virtualenvs.in-project true Use code with caution. Step 2: Recreate the environment

Some Python libraries do not ship with built-in type hints. Pylance might successfully find the code but complain that it cannot find the type definitions.