Examples of inheritance in Blender

Thanks! Yes, many roads leads to rome I heard. I’ll check the link, but it’s a bit old (7 years ago), but interesting read. Myabe the thread Inheritance of objects gives an entry point as well.

In the Blender API overview I found

import bpy
class BaseOperator:
    def execute(self, context):
        print("Hello World BaseClass")
        return {'FINISHED'}

class SimpleOperator(bpy.types.Operator, BaseOperator):
    bl_idname = "object.simple_operator"
    bl_label = "Tool Name"

bpy.utils.register_class(SimpleOperator)

Which is a mix in example. And overview says “Regarding inheritance, Blender doesn’t impose restrictions on the kinds of class inheritance used, the registration checks will use attributes and functions defined in parent classes.”

And says: " Notice these classes don’t define an __init__(self) function. While __init__() and __del__() will be called if defined, the class instances lifetime only spans the execution. So a panel for example will have a new instance for every redraw, for this reason there is rarely a cause to store variables in the panel instance. Instead, persistent variables should be stored in Blender’s data so that the state can be restored when Blender is restarted."