Hi!
Here's a quote from the manual to that effect

Functions assigned to or called by entities - that means all functions in which the my pointer is not zero - are automatically terminated at their next wait call. All other functions in which my is zero, such as the main() function, will keep running and won't change, even if a different script was assigned in WED to the new level.