Exit, Then Re-enter Staircase Loops

OS (e.g. Win10): win 10
PsychoPy version (e.g. 1.84.x): 2022.2.5
**Standard Standalone? y
What are you trying to achieve?:
I’m using PsychoPy Builder with some custom code. I have an outer loop and two staircase loops (with dummy loops around them in order to select them). I want the inner staircase loops to retain their state even though the staircase loop will be exited after a single iteration. the outer loop determines which of the staircase loops continues by iterating through a list. So:

  1. I have an outer loop that contains 2 inner loops. Each of these inner loops is a linear staircase corresponding to a different eccentricity location.
  2. Each staircase loop includes a stimulus presentation routine and a response routine.
  3. Each inner loop (staircase) is wrapped in a dummy loop. this is because i have a randomized staircase selector.
  4. I shuffle a list and set the value of the dummy loop (nReps) based on this shuffled list, so that only one of the staircases is selected in each iteration of the outer loop.
loop_selector = [random.choice([0, 1]) for _ in range(20)]

begin routine:
# Reset all do_ecc variables to 0
do_ecc0 = 0
do_ecc10 = 0

# Get current eccentricity
current_eccentricity = loop_selector.pop(0)  # Get and remove the first element from the list

# Set the corresponding do_ecc variable based on the current eccentricity
if current_eccentricity == 0:
    do_ecc0 = 1
elif current_eccentricity == 1:
    do_ecc10 = 1
  1. The staircases should retain their state across iterations, updating based on participant responses.
  2. Each iteration of the outer loop should Update the staircase based on the participant’s response.
  3. Each staircase should proceed with only one repetition per iteration of the outer loop.

What did you try to make it work?:
I tried to save the staircase information, unsuccessfully, and then reinitialize it from that state. How can i continue with the staircases from their previous state? I want it to be the case that staircase-a may be selected and continue for one trial. then, other times staircase-b may be selected and continue for one trial. But they never seem to retain their current state. ‘level’ acts as though it is the first time it has entered the staircase whenever either of the two staircases are selected as determined by the randomized list that selects the ‘dummy’ loops to initiate the associated staircase.