Testing changes to a multi file addon?

How can I test changes made to a multi file addon? I have been tweaking one and every time I want to test the changes I made, I have to close and restart blender. For a single file addon, I just hit run script to test the changes.

Just hit F8, this reloads all scripts.

Another option is disabling and re-enabling the add-on in preferences menu.

I will test this out later.

I have done this before ,but it doesn’t always let you enable it and you have to restart blender.

Sub modules imports dosen’t reload using f8, unless explicitely coded using importlib to do so.

I have made a tiny library for this called pylivecoding


it basically reloads the module and replaces references to the old class with references to new classes that have the modified code. This works for classes and instance objects because even instance objects reference the class object for accessing the instance methods.

Python allows to reload the module but does not allow by default to update existing live objects with the new objects. Which is what most of my code is doing automatically.

Please note for code in a init method it still wont magically work because that method is called only on instance creation. This is a standard live coding behavior because messing with object initializing is a bad things which can lead in very unpredictable results.

I used this library for the development of Morpheas a GUI API for blender using the bgl module that gives access to OpenGL 1 via blender window.

The library is not optimised to auto detect changes in the code and reload them , the reload happens manually via the update method and you will have to also register manually the modules to be added to the live environment which is turn handles all the code reloading and updates instances of classes to the new classes that contain the updated code.

The good thing about this approach vs restarting the script is that data is not lost and the code continues to execute even in the case of error like the error never happened.

more detailed documnetation can be found in the project’s main page

1 Like

Well, this is kinda off topic ,but how the heck do I use “f + number” keys in blender? f8 changes my volume and when I hit f8 that’s exactly what it tries to do when blender is open.

Google sg like “how to use function keys on laptop keyboard”
I have an “(Fn)” button on mine.