Global functions at the Collection level

How can I use global function (which receives parameters) in the Collection level (either in the Pre-Request or Tests section) and afterwards call the function from the request?
I tried implementing it, and it failed. Got error that the function is not defined.