Hi Deniss,
custom scripts are conceptually different than embedded forms. Custom scripts get executed only once when the page loads. You can of curse write an angular module in the custom script that you can then inject in an embedded form.
However, I think for saving variables in the process between process steps, you should actually save them as process variables.
Cheers
Sebastian