https://github.com/razcore-rad/blender-addon-dev-watcher
Hot-reload Blender addons during development
https://github.com/razcore-rad/blender-addon-dev-watcher
addon blender blender-addon blender-plugin development hot-reload hot-reloading live-reload live-reloading python watch watcher
Last synced: 8 days ago
JSON representation
Hot-reload Blender addons during development
- Host: GitHub
- URL: https://github.com/razcore-rad/blender-addon-dev-watcher
- Owner: razcore-rad
- License: mit
- Created: 2023-10-03T13:26:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T07:02:08.000Z (over 1 year ago)
- Last Synced: 2025-04-04T10:23:34.829Z (6 months ago)
- Topics: addon, blender, blender-addon, blender-plugin, development, hot-reload, hot-reloading, live-reload, live-reloading, python, watch, watcher
- Language: Python
- Homepage:
- Size: 93.8 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# INFO
Tested with Blender 4.0.2.
# Blender Addon Dev Watcher
This addon auto-reloads the watched addons when file changes get detected for a fast development cycle.
It uses the Python [watchdog](https://github.com/gorakhargosh/watchdog) module.
## The Problem
Blender addon development is greatly slowed down due to lack of hot-reloading on file changes.
Some proposed workarounds include:
1. Refresh followed by disabling/enabling the addon from the `Preferences... > Add-ons` panel.
2. Using the `Reload Scripts` button.
Both of these options are less than ideal.
## The Solution
This addon found under the `View 3D > Sidebar > Tool > Addon Dev Watcher` panel lists the available (user) addons in the top list apart from itself.

We can add any addon from the top list to the bottom list with the `Add Watch` button. This starts a `watchdog` process waiting for file changes in the respective addon. When such a file change is detected it auto-reloads that addon.
To remove an addon from the watch list use the `Remove Watch` button.
That's it, nice and simple.
## Notes
For now, there are no preference and the addon resets every time Blender is restart. This means that you have to actively add an addon to the watched list every restart.
The addon adds itself to the watch list and can't be unwatched. This is so we can hot-reload it during development at any time for whatever reason.
Refreshing the addon is done with the help of the `bpy.ops.preferences.addon_disable()`, `bpy.ops.preferences.addon_enable()` Blender function, and a solution to recursively reload modules from [this gist](https://gist.github.com/KristianHolsheimer/f139646259056c1dffbf79169f84c5de).
The watchdog dependency is installed in the `ADDON_PATH/dependnecies` local folder by creating a virtual environment using the `venv` module.