How do I switch scenes while keeping a script running in the previous scene?

How?

you don't. Slow down, please!