Is there a easy way to define functions to use across multiple requests that is not the eval

hi all, I’m here to see if there is a better way of doing “How to reuse Postman scripts and tests among different test cases” without using the eval method?

I want to do something like why described here: and I would like to do it in a more structured way then using eval and global variables.

can someone maybe guide me in a way I could do this? or is eval really the only way to go?