How to run the dialog in a Python plugin

I want to write a plugin in Python that calls my commonly used tools by clicking on a button,
For example, clicking the levels button will bring up the levels dialog,
How to write code to run the levels dialog in a Python plugin.
:thinking:
click levels
1
pop up levels dialog
2

In the general case, you can’t… the Python plugins cannot act on the UI. There are some cases where a function can be asked to pop out an interactive dialog (with a named parameter: function(arg1,arg2,run_mode=RUN_INTERACTIVE)) but this doesn’t apply to the API that are behind Curves/Levels.

I don’t want to operate the UI, I just want to click on the button in the plugin,to achieve the goal of clicking on levels in the menu. :yum: