The nanoflow parameter type allows you to pass a nanoflow that you can call from your JavaScript action. Maybe you can try calling a Nanflow from JavaScript action. That Nanoflow will actually call your 2nd JavaScript action.
Also please check this widget if it helps
https://appstore.home.mendix.com/link/app/111132/