I have an addon with various modules and submodules. One of these submodules is specifically for handlers. When testing my addon, I noticed that whenever I installed and loaded the addon, the handler within my handler module would not register. How do I register a persistent handler as part of a submodule in an addon? And, how do I make sure that the handler is only registered once, and unregistered if the addon is removed?
import bpy import os from bpy.app.handlers import persistent @persistent def my_load_handler(dummy): print("Load Handler:", bpy.data.filepath) def register(): bpy.app.handlers.load_post.append(my_load_handler) def unregister(): bpy.app.handlers.load_post.remove(my_load_handler)