FilipeAlmeida:
So, for example, in the code of the button press I insert an if statement checking "actionstarted == False" and then inside I update "actionstarted = True". Then comes the stuff to be executed and in the end of the code I update again "actionstarted = False". Similar to debouncing using millis()
Yes, that's the idea.
And when you're at it, look into the concept of "finite state machine" as that's what you're doing here. You put your machine into a different state based on button press and code execution stage.