How to execute functions simultaneously in this case?

@gcjr, I said it in my first message. If I toggle the stepper, I have to wait for the for loop to end (which takes about 10 seconds)..