Get operator command from context menu?
The answer is in the example code.
When executed over the splash screen button, it prints to console
Note have added
def dump(obj, text):
    print(text, obj)
    ...

to the dump method to inform which of the button context members are not None
button_operator &lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;
&lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;.__doc__ = None
&lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;.__module__ = bpy.types
&lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;.__slots__ = ()
&lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;.bl_rna = &lt;bpy_struct, Struct(&quot;WM_OT_splash&quot;) at 0x7f477da08e48&gt;
&lt;bpy_struct, WM_OT_splash at 0x7f474dff47e8&gt;.rna_type = &lt;bpy_struct, Struct(&quot;WM_OT_splash&quot;) at 0x7f477da08e48&gt;

Going by blenders naming convention the class instance above of WM_OT_splash correlates to window manager operator type splash --&gt; the registered operator bpy.ops.wm.splash() with bl_idname = &quot;wm.splash&quot;.
Ok can change up the script to get the operator from the button context.
def execute(self, context):
    op = getattr(context, &quot;button_operator&quot;)
    if op:
        print(op)
        
    return {'FINISHED'}

Lets run this new code over the run script button
&lt;bpy_struct, TEXT_OT_run_script at 0x7f9606bf4a68&gt;

Looks familiar off to the python console. Examples of the active operator (last registered operator run) and how to get the options used in the last run of the operator.  IMO the py console is a great place to peck around and work out how things work.  The example script that prints the dir of available properties is another
&gt;&gt;&gt; op = C.active_operator
&gt;&gt;&gt; op
&lt;bpy_struct, Operator(&quot;TEXT_OT_run_script&quot;) at 0x7f4755ffa708&gt;

&gt;&gt;&gt; op.rna_type
&lt;bpy_struct, Struct(&quot;TEXT_OT_run_script&quot;) at 0x7f477c30cde8&gt;

&gt;&gt;&gt; C.window_manager.operator_properties_last(&quot;text.run_script&quot;)
&lt;bpy_struct, TEXT_OT_run_script at 0x7f9606bf4b08&gt;

To get there quickly, Feel there is a nicer way to do this, anyway
Get the operator, get its bl_idname from the class name.
If there is a property attached to the button it is reflected in the button context. From the operator get its properties (minus rna_type) to find which belong to the operator.
Get the operator from bpy.ops invoke it and use the settings of the button.
Following writes info re the operator and also invokes it.
def execute(self, context):
    op = getattr(context, &quot;button_operator&quot;)
    if op:
        
        foo, bar = op.bl_rna.identifier.split(&quot;_OT_&quot;)
        keys = set(op.bl_rna.properties.keys()) - {'rna_type'}
        kwargs = {k : getattr(op, k) for k in dir(op) if k in keys}
        print(foo.lower(), bar, kwargs)
        op_callable = getattr(getattr(bpy.ops, foo.lower()), bar)
        # run the op
        op_callable('INVOKE_DEFAULT', **kwargs)
    return {'FINISHED'}

Which if run over the add custom property to workspace in 3D view UI, prints the following to console
wm properties_add {'data_path': 'workspace'}

and runs the operator adding a new custom property to the workspace.