Lets just suppose i didnt read the sentence "and at the end of the function it continues on its path? " because it makes absolutely no sense.
Lets just suppose I just read your thread title, then while loops are what you are looking for:
var somevariable;
function dosomething
{
while(1){
while(somevariable){wait(1);}
//add some stuff here
wait(1);
}
}
you just have to set var somevariable to 1 to freeze the function.