How to use IDEs for Addon Development? And ideas for improving it with 2.8

Hello, I’m currently developing mainly Python tools for scientific usage and I considered creating some blender Addons mainly for interaction with another application that I often deal with. I also have a use case in mind where blender’s 3d environment could be a suitable UI of another application I already started in Python (for controlling stage lights).

I hold back starting with some of the ideas until 2.8 and now I started wondering what tool chain is commonly used to create addons for blender?

While the internal editor gives basic editing capabilities I would only consider using it for small scripts. I like the completion capability of the python console to discover the API but non of this is usable (as far as I’m aware) when I want to create addons using a fully fledged Python IDE which is generally able to do live inspections, refactoring, suggestions as well as integrate unit testing.

I’m aware of a python script that exports the API but it is claimed to be outdated and I’m also aware of an unofficial way to build blender as a python module.

But while this is a question on the one hand for existing solutions, since the API gets an overhaul for 2.8 anyway I think it would also not harm to draw the attention to the idea of officially and directly considering enabling more sophisticated Addon development using external tools with the upcoming 2.8 API.

This means having official ways to inspect the blender API and documentation from Python IDEs with error checks as well as also ways of running unit test inside the blender environment from that.

What I could imagine is maybe that blender also comes with an official way to use it as a python module, maybe directly delivered with the binary packages, one could then add this to existing python paths or virtual envs for example.


I was looking into the same myself last week. The most updated script I could find seems to work fine with 2.8, and there is also a possibility to use a debugger, but I haven’t tried this yet.

It’s all a bit hackish though, I’d love to see the symbols being generated as part of the build process and made available for download, as well as debugging as a core addon.


Blender does not stop you from using any IDE you want. You can even use blender like python because like python blender can be used from the terminal/ command line to run a python script.

I was using PyCharm so far and it worked fine although lately because I only code in C , I use Visual Code. Debugging wise I have been doing it via pdb.set_trace() , it has been working fine for me with PyCharm. I also developed a small library to allow me to reload python code without reloading my addon. It basically reimports modules and replace references to old classes of their instances with references to new classes because python’s standard reimport does not allow me to do that.

This live coding library made redundant most of the usage of a debugger cause it converted my source files to individual REPLs in essense. I also wrapped my code into a post mortem debugging exception which in case of python error it triggered the debugger with the error on the line the error occurred without having to use set_trace.

Other’s have went down the route of remote debugging to trigger debugging from inside their favorite IDE.

I am sure there are like a gazilion other ways to do this. So its up to the addon developer.

With C coding I also developed live coding library, with the only diffirence instead of reloading modules it reloads DLLs which is where my code lives so I can reduce Blender build times from a minute down to one second because I usually rebuild only my DLL. By DLL I mean also Linux and MacOS and not just windows.

I’ve spent a lot of time trying to get decent auto completion the past two weeks and none of the generation scripts I’ve tried have worked very well, PyCharm still giving me a lot of errors about unexpected arguments, and sometimes missing entire modules. I spent over a week trying to compile the python module, but have failed to make it work.

I’ve resorted to writing my own .pyi stubs. If there’s interest I would be willing to share them on GitHub when they’re further along.


I use vs_code with:

Also sometimes it it nice to use ipdb for debugging in blender console with auto-completion.
Run: pip install ipdb
And the in you script add:

import sys
dir = ‘C:\Users\JoseConseco\AppData\Local\Programs\Python\Python37\Lib\site-packages’
if not dir in sys.path:
sys.path.append(dir )
import ipdb
And for adding breakpoing use:

@brhumphe Will those .pyi stubs work on for auto completion for ? And will they work in vs code?

  1. Yeah. IIRC that was missing from fake_bpy, whereas pyrefdef doesn’t generate very good code and has a lot of incorrect function signatures.

  2. I would assume so, because they are officially defined in PEP 484 for exactly that use case, but I don’t know specifically.

Hi, I’m the guy who wrote the vscode debugger addon and saw this thread and thought I’d chime in.

I personally don’t care that much about autocomplete (part of this is VS Code’s fault because there was a problem with module autocomplete being so slow it was unusable), so I got used to keeping the blender api documentation open in another window, buy many do and I’ve had many many questions about this.

While I agree debugging can be left to addons, for autocompletion, this overcomplicates things in the sense that there is already a solution that works well (blender as a python module) that doesn’t require anyone write any complicated code to extract stubs. Also I’ve tried all the python stub generators and they’ve all had problems. They also tend to become un-maintained sometimes.

So for autocomplete, the solution is blender as a python module, BUT…

  • The building blender as a python module wiki page disappeared? I’ve been meaning to ask, what’s up with that? Is it going to come back? I watched the blender conference q&a and they said they’re not dropping it, so… ?
  • Blender does not offer a download for blender built as a python module. I know it’s technically experimental, but there could just be a warning just like there is with 2.8 builds. Is there some reason why this isn’t done? Just doing this, would go a long long way.
  • Because of the above, I think very few people know this feature exists, or what it can even be used for. I think you’d see a lot more use if people knew about it and it’s use for autocompletion.
  • Although the wiki has a part about setting up your IDE, debugging, etc, for blender development, the equivalent for addon development does not seem to exist afaik. Actually now that I think about it, important stuff regarding addon development is kind of scattered everywhere (some in the API, some in the manual, some in the wiki, some in the old wiki).
  • Building blender as a python module and installing it is not easy. I know, once you’ve done it a couple times, it’s hard to imagine, but that’s because all the hard stuff is done, now you just make update then make bpy and in my case I made myself a little install script. But, just imagine if you’re a beginner who’s maybe only done a few blender scripts or a little bit of python. To get proper autocomplete, currently they would have to get python, git, svn, cmake, then if you have crap internet like me, wait a billion years to download the repo, be sure to get the submodules and libraries and all that, AND the 5GB worth of VS build tools, and that’s just the setup! Even I, who knew some of this stuff, but had never built any C/C++ programs, had a bit of trouble. And it felt like this completely unnecessary brick wall just for autocomplete.

Now technically part of my build troubles were my fault because I wanted to avoid having to download the 5GB worth of visual studio stuff because I already had just the build tools installed but the blender build script wouldn’t detect them. I solved it at the time and now thankfully you can use them without problems, and this is minor, but, maybe this should be mentioned in the wiki? It still says Visual Studio is required which it technically isn’t. Many people might already have the built tools installed.

Anyways, slightly unrelated, but does anybody use Anaconda? because I can’t seem to get the blender module to work if I install it in an environment, only if I install it to the base one.


I’ve used Blender as a Python module and it works well for autocompletion. Unfortunately you can’t do this with 2.8 yet, which restricts it’s usefulness somewhat.

I’ve given up trying to build as a module. If anyone feels like helping me go checkout the ticket I opened T58069.

If you are able to compile it as a module, there is a trick to get it working in Python. The dlls and bpy.pyd needs to be in the Lib folder, not the site-packages. Also 2.80 (or 2.79) needs to be under the root Python installation.

You can try it with a virtualenv (python -m venv python_venv)

This set up works perfectly in Ipython and Pydev(under Eclipse). The Pydev Vscode addon does an excellent job with this setup too, but it is a pricey addon.

By default both Pycharm and Vscode Python do not do a good job with non standard libraries.

Also try this inside the blender source for compiling, at least on Windows “make bpy 2017 x64” This by default builds the bpy and the rest without any settings.