Change of scene after synchronous function?

So by default, if I call a function in a event, the following events will be executed right after with no delay. What if the next event is a change of scene? I have noticed that my function doesn’t finish to execute if there’s a change of scene.