Vex code Memory permission error

I am getting a Memory permission error.

This happens when I press the button (L1) and instead of my piston moving everything freezes and the Memory permission error appears on the brain.
Before I press the button, I am still able to drive around fine and my auton works perfect as well even though it calls the exact same function that moves the piston.
This used to be able to work fine so I am not sure why it is suddenly doing this.

Any help would be appreciated, Thanks!

Code → Python Text in Vex code V5
Error message → Memory permission error 0380DE6C
Actual Code → 6 m official.v5python (12.6 KB)

Edit → i belive it is somthing to do with these lines of code

Is there somthing wong with that or is there somthing wrong with how i write the functions

def Open():
back.set_velocity(100, PERCENT)

def lock():
back.spin(FORWARD, .6, VOLT)

#clamping function
def test():
global myVariable, pnumaticsOn
if pnumaticsOn:
pnumaticsOn = False
wait(.1, SECONDS)
pnumaticsOn = True
wait(.1, SECONDS)

That’s an issue with the VM related to scheduling, not sure how to solve that one (or if I can)

Add a

wait(10, MSEC)

to the end of the While True: loop in driver control and it should be ok.