How to call view3d.select_circle operator in my own operator?

I bind a hotkey ‘U’ to view3d.select_circle and it works well. but call view3d.select_circle from my operator can not change select tool, just unselect mesh and objects.
What is the right way to call view3d.select_circle in my operator?

class VIEW3D_OT_UnselectSelect(bpy.types.Operator):
    """Unselect all then change select tool"""
    bl_idname = "zh_object.unselect_select"
    bl_label = "Circle"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        return {'FINISHED'}

def register():
    wm = bpy.context.window_manager

    km ="3D View", space_type="VIEW_3D")
    kmi ='zh_object.unselect_select', 'C', 'CLICK') = '' = True
    km ="3D View", space_type="VIEW_3D")
    kmi ='view3d.select_circle', 'U', 'CLICK') = '' = True


1 Like

Thanks, that helps a lot. Can I find this from API reference?
Thi api I found from reference page is
bpy.ops.view3d.select_circle(x=0, y=0, radius=25, wait_for_input=True, mode='SET'), and it doesn’t mention ‘INVOKE_DEFAULT’ at all.

Yes, it’s a general bpy.ops thing (kind of like context overrides, if you’re familiar with those), so there won’t be any mention of it in individual operator documentation.

The docs mention this but it’s worth re-iterating, the default execution context when calling an operator from a script is EXEC_DEFAULT, which as the name implies calls the execute function (which has no event, and thus- no mouse position). INVOKE_DEFAULT will tell it to call the invoke function, assuming there is one- that way you have an event, and a mouse position.

Thanks for your reply. I do read this document, but it didn’t left a footprint for a beginner of python and blender api. This vivid use case will bring better understand of it. I am not sure if you can get my English, hahahahaha