What problem you are facing to call the one event code in another event?
You can make the function and according to your requirement you can call that function in both the event if you want to use one function code in another the simply call the function in each event by calling function name and in last you can open your modal popup in second event after function call.