# Linting Blender Python in VSCode

I use Visual Studio Code (VSCode) as a dev environment for Blender addons. I installed the ms-python.python extension, and enabled the language server for pylint linting.

But, it doesn't know about Blender's various built-in modules:

What's the best solution to this? It would be ideal if I can enable strict checking on bpy and friends. But I would also accept if the best answer is just to configure the linter to ignore certain unresolved imports.

Push Ctrl+Shift+P to open the command bar.

Paste ">Preferences: Open Settings (JSON)" (without the quotes) into it and press Enter.

In the text editor on the right side you need to paste in:

"python.analysis.disabled": ["unresolved-import", "use-before-def"],


(The whole line, do not forget the parenthesis in the beginning! It needs to be somewhere between the curly brackets)

You can also suppress linter warnings with:

"python.linting.pep8Args": ["--ignore=E501, E126"],


(However this line changes depending on your active line interpreter, which you can set with: ">Python: Select Linter", I opted for the PEP8 one, seems I am a little masochist... The E numbers in the end changes depending on the actual error messages you want to be gone.)

Last step would be to save the .json and you are good to go!

• This did not work in VSC's latest version. the linter still gives the same error. Any follow up on a way to resolve it? Sep 26, 2019 at 20:34

For this specific case you could try the Fake BPY module, which seems to be designed to solve this: https://github.com/nutti/fake-bpy-module

• Can also build bpy as a python module. Dec 26, 2019 at 13:09

Just disable "Python › Linting: Enabled" checkbox in VSCODE settings

• A side effect of this recommendation is that I don't get any linting :( Jul 30, 2021 at 12:59