How to make a Delete operator with its confirmation window?
Invoke the WindowManager.invoke_confirm
IMO the way this was is confusing. If your desire is to delete an object by name, can instead get it from the scene by name and remove it.
As it was would remove active, selected and &quot;obj&quot; if it existed, or simply throw an error if it didn't.
Have passed an override to the delete object operator to only delete the object known with name self.obj if it is linked to the context scene.
Test script, run in text editor throws up the confirm menu.
import bpy

class MYADDON_OT_Delete(bpy.types.Operator):
    bl_idname = &quot;myaddon.delete&quot;
    bl_label = &quot;Delete Object&quot;
    bl_options = {'REGISTER', 'UNDO'}

    obj: bpy.props.StringProperty()
    use_global: bpy.props.BoolProperty(default=False)

    @classmethod
    def description(self, context, event):
        return f&quot;Delete {event.obj}&quot;
    
    def execute(self, context):
        scene = context.scene
        obj = scene.objects.get(self.obj)
        if obj:
            return bpy.ops.object.delete(
                {
                     &quot;object&quot; : None,
                     &quot;selected_objects&quot; : [obj]
                 },
                 use_global = self.use_global
            )

        return {'CANCELLED'}
        
    def invoke(self, context, event):
        self.use_global = event.shift
        wm = context.window_manager
        if event.shift:
            return wm.invoke_confirm(self, event)
        return self.execute(context)

def draw(self, context):
    layout = self.layout        
    op = layout.operator(&quot;myaddon.delete&quot;)
    op.obj = &quot;Cube&quot;

if __name__ == &quot;__main__&quot;:    
    bpy.utils.register_class(MYADDON_OT_Delete)
    bpy.types.TEXT_HT_footer.prepend(draw)
    bpy.ops.myaddon.delete('INVOKE_DEFAULT', obj=&quot;Cube&quot;)