How can we use the bpy Python module (built from source) properly in Visual Studio Code?

I have compiled Blender as a Python module and successfully use it in Eclipse. I can also import the bpy module just fine from a Python console. However, I more and more switch to Visual Studio Code for coding tasks, and now wonder how to get proper autocompletion there.

In Eclipse, I can define an interpreter and hook it up with the relevant Python paths:

How would I define the same in Visual Studio Code? I have the Python extension installed, but I don’t know how to proceed from there.

On win 10 at least:

  1. Move bpy.pyd to PYTHONPATH\Lib\site-packages
  2. Ctrl shift p in vscode -> Select Interpreter
  3. Select the appropriate workspace
  4. Select the python interpreter located at PYTHONPATH

That’s about it. Pretty sure I never even touched settings.json.
Maybe it’s possible without ever moving the file using includes, but it “just works” so I never cared.
Granted, the auto-completion isn’t entirely instant, but it’s much better than it was just 6 months ago.


me i followed this tutorial and it worked just fine

Annotation 2020-02-25 124432

i still don’t get what is the proper workflow to execute a code from VS to blender or reload an addon tho.

i used a custom script for reloading one file addons and running scripts automatically. but there must be something better.

there was the jacke lucke VS plugin but it’s broken right ? not sure

Not working on my side unfortunately. Have completed steps 1 and 2. Not sure about what you mean with 3. Have done 4 as well. Maybe there is something unrelated off on my side, as even for modules like os I get completely nonsense AutoComplete:


The completion offered are methods and props from the package I am working in. Not sure why this is the case here.

never mind, got it fixed by removing some variables from my settings.json that apparently did more damage than they could help. Thanks, all working now!

1 Like

nope, still works fine