Feasability: "disabling" a pushbutton while code is running

Hi again

xl97:
Just dont check the state (change) of that particular button then?

But I have to to be constantly checking for a button press to execute the code.
Sorry, it may be trivial but I do not understand.

UKHeliBob:
Make reading the button state dependant on a boolean. Change the state of the boolean to enable/disable reading the state of the button.

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()

Can be something like this?

Thanks for the help.
Filipe Almeida