i'm afraid that there is no way to assign functions in a script and be able to call the function in another script, jsreport for security reasons by default execute scripts in another process, functions can't be passed across these processes, however to do what you want you have some options:
store your functions in an asset file and just import the asset in every script where you need your functions, example:
https://playground.jsreport.net/studio/workspace/BJP7eMYTe/22
save your functions in a file, and just require that file in your scripts. var functions = require('./path/to/functions.js')