I wrote some user-defined, custom functions within server side script but I'm getting errors

I have written two python functions within my server-side script and I have to call them a few times to do my job. But when the script runs it throws the error that the functions are not defined. I am using the ERPNext interface to do this scripting. Is there any other way to call user-defined functions in server-side scripting?