Detecting that a specific object has been removed from the scene

Hy everyone,
I registered an object in a property pointer and I would like to know if there is an event that is triggered every time an object is deleted so that if the frame is deleted from the scene the script can detect it and reset the parameters.

class ArmatureProp(bpy.types.PropertyGroup):
       obj : bpy.props.PointerProperty(type=bpy.types.Object)

Good day,

import bpy
context = bpy.context

class ARMATURE_PG_myprops(bpy.types.PropertyGroup):
   obj: bpy.props.PointerProperty(type=bpy.types.Object)

def check_ob_in_scene(scene):
    ob = scene.arm_props.obj

    if ob is not None:
        if not in scene.objects:
            scene.arm_props.obj = None

def register():
    bpy.types.Scene.arm_props = bpy.props.PointerProperty(type=ARMATURE_PG_myprops)
    if not check_ob_in_scene in

def unregister():
    if check_ob_in_scene in


context.scene.arm_props.obj ="Suzanne", "")

Thanks for your code. I didn’t know yet.

Good day,