How to Configure Visual Studio Code for Blender Add-on Creation

Starting from September 10th, 2024, I began building my own Blender add-on. Initially, I thought it would be straightforward to configure Visual Studio Code (VS Code) for developing Blender add-ons. However, I soon found that setting up VS Code for this purpose was quite tedious. After a few days of trial and error, I finally discovered a standardized and sustainable process for developing Blender add-ons using VS Code. In this blog post, I'll share my step-by-step guide to help you set up VS Code for Blender add-on development.
Reload addon in Blender when a document is saved
. Ctrl + Shift + P
to open the Command Palette. New Addon
and select Simple
. This will generate the required files for a basic Blender add-on.
Ctrl + Shift + P
and search for Blender Start
. Blender should now open automatically. To activate the add-on, go to Preferences
> Add-ons
and search for [Your Add-on Name]
.
At this point, the add-on is registered but not yet functional.
*.py
file in your project and add the following code:import bpy
If you encounter an error stating that bpy
is not found, proceed to the next step.
Ctrl + Shift + P
to open the Command Palette and search for Select Interpreter
.C:
drive on Windows). pip install fake-bpy-module
This command installs a fake version of the bpy
module, which simulates the Blender Python API. You can find more details about this package here.