Search code examples
pythonvisual-studio-codepylint

Python peek definition works in vscode, but pylint complains about being unable to import


I want to test some python files in a project before installing them. For this I entered the folder to be installed in my vscode workspace settings as follows:

"python.autoComplete.extraPaths": [
    "${workspaceRoot}/lib_python/release"
]

Now I have a test file in my workspace that imports from the above mentioned folder. Suggestions work fine, it also gives me definitions while hovering with the mouse over a class name from the imported file. However, half my code is underlined in red, because pylint says it does not know the definitions and cannot import.

Question: Is there a way to also make whatever part of the python plugin by Don Jayamanne is responsible for the red underlining find the additional import folders?


Solution

  • So what worked for me now is to set additional paths in a .env file in the project's root folder. This file will be read by the python extension of vscode.

    Example:

    PYTHONPATH=./lib_python/release