Mouse clicked on a script button

I wrote the code:
button = event.source.parent.getComponent(“BUTTON_X”)

And ok, it works.
But, If I want the
button.mouseRelease() ¿?¿?¿
Is there any solution to call to mouseRelease event from the script?¿
Thanks in advance,

As far as I know, you can’t easily invoke a mouse release event on a button virtually. In my opinion, it sounds like you need to rethink your methodology. If you need to call a script from other places than the button that has the script, you need to move it to a project script then call it from where ever you need it.


Listen to @dkhayes117

What you’re describing - all the logic being on a GUI component - is known as the Magic Push Button anti-pattern.

It’s a huge personal pet peeve of mine after cleaning up a bunch of them.

Thanks to all,
Finally I put the script code into button / actionPerformed and It works for me with the action .doclick().
Ok, I didn’t know that I couldn’t call a mouse button click from the script.