How to execute functions simultaneously in this case?

@blh64 it is a simple question of executing another task while a for loop is running, which seems impossible here.