I admit that your explanations still don't make any sense to me. If it does not return to the calling function, then where does it return to?

Can you check the return path in the debugger of your development system? Or are you calling engine_getscript not from an external language but from within a script?