How to know the order in which scripts are loaded?

I have not tested this handle, but I imagine that it executes a function every time you load a Blender file, not just when you open the blender for the first time. I hope to be wrong.

However I found out how to change the order in which addons are registereds.
To change the order of execution of an addon, you have to disable this addon and enable again. So it will be at the end of the sequence.
So, just run these lines inside the register function of your addon:


def register():        
    if bpy.context.user_preferences.addons[-1].module != __name__:
        module_name = __name__
        addons = bpy.context.user_preferences.addons


        while module_name in addons:
            addon = addons.get(module_name)
            if addon:
                addons.remove(addon)


        addon = addons.new()
        addon.module = module_name

However, each time you enable an addon, it will be in front. Then the addon will only be the last until the second time you open Blender without enabling any addon. A small disadvantage.

1 Like