how to press this button with the same variables inside using another button in different widget and do the same logic without recreating it for the second button
Create an actor component with all the common logic… Functions, macros, events etc.
Add the actor component to your widget.
For ease of use you can create a BP Interface to execute the logic without storing a direct reference to the actor component class.
You can add an actor component to a widget!? I never considered that…what have I been doing with my life?