Moving back and forth between routines

Hi everyone,
I’m trying to build an experiment where participants will be shown some pictures in sequence, and then they have to answer some questions about those pictures. However, I want to make sure that they can go back to check the pictures before they answer the questions as many times as they want(when they go back to see the pictures, I want them to be able to check all the pictures in sequence again).
Right now, I have all the pictures in one routine(attached to a loop, the pictures are actually in excel) and the questions in different routines. I can see all the pictures and then the questions, but I can’t move back to recheck the pictures. I would like them to use up and down on the keyboard to move back and forth.
I tried some codes that were available here from previous topics, but they did not work.
Does anyone know how I could fix that?
Thanks in advance!

1 Like


I’ve implemented something potentially of interest here.
In the future, may I suggest that you list what previous solutions you’ve already tried (including links) and how exactly they failed (including error messages)? Just telling us that you tried something and it didn’t work only provides us with very limited information on how we might be able to help you. :slight_smile:


thank you for your response.
Like I said previously, I have one routine with the pictures in one loop(excel) and four more routines with questions in each one of them. In think in some way, the outer lop keeps the first routine repeating (I had 200 nReps on it).
What I’m trying to have participants moving back and forth between these routines, always in the same sequence.

I also tried to work with the resources from this link here but I was only able to run the instructions, when it gets to the routine with the images it just stops.

Again, thank you for your help!

Hi again,

Without having seen your actual implementation, it’s very difficult to work out what exactly is going wrong. If you could upload your experiment (or perhaps a minimal version of your experiment illustrating the issue), that would help us to help you.


I’m sorry if I’m not being very clear on what is going on. I’m very new to all that…
I created a sample that is exactly similar to the experiment so you can have an idea of what I mean. Not sure if you will be able to see everything but in trial1_fruit1_loop is where the pics should be in excel. I want to be able to move back and forth from this routine, to the other routines(Question1,Question2…), but when they move back to the pics(trial_fruit1) I want them to always see the pics in sequence.
Very thankful for your help,
I hope I was a little more helpful explaining this time.

Sample1.psyexp (33.9 KB)

A couple of questions for clarification:

  • Do they need to see all the pictures before they move on to the questions? (Or could they say that they would like to move on to the questions after they’ve seen, say, only half of the pictures again?)
  • Once they have decided to move on to the questions, I assume they cannot return to the pictures. Is this correct?

Yes, they need to see all the pictures and then move to the questions.
If they move to the questions, I want to allow then to still go back and check the pictures.
They are basically allowed to check the pictures as many times as they want to be able to answer the questions.
For instance, someone checked the pics, and is answering the first questions. If that person wants to go back to the pictures, I want them to be able to do it. However, I want the pictures to be always in the same sequence, never random.

Ah, OK. So, let’s assume someone answers questions 1 and 2, and then indicates that they would like to see the pictures again. After seeing the pictures, would they be asked question 1 and 2 again?

They would have to pass through question 1 and 2 again. I basically just want them to be able to move up and down like we do on a PPT, for instance. Not that they would have to change their answers to question 1 and 2, but they should pass through the questions again if they want to go back to check the pics.

OK. Are all questions similar (in the sense that they differ only in what is being displayed on the screen)? If yes, you could read the question text from an input file as well and would need only one routine for the questions (this would potentially make going back to the pictures a bit more straightforward).

I actually tried to put the questions in different routines because I want people to give the answer on the routine itself(I will do that on the textboxes in each routine). Could I still be able to do that if I put everything on an input file?

I’m not sure what you mean by “give the answer on the routine itself”. Could you explain why you think you need a separate routine for each question in another way? Or upload an example that includes the actual questions you would like to ask.

I’m trying to have the participants typing their answers on the experiment. Like I said, I don’t know if a need a routine for each question to allow them to do that or if I can have all the question in a input file, still allowing the responses to be typed. I thought the best way to allow typed responses was having the questions in different routines.


Please find a minimal working example attached. Please note:

  • Images are not actually images, but text. For your experiment, you would need to replace the text component with an image component.
  • Typed answers to the questions are not displayed.
  • To move on to the next question, press Enter.
  • To return to the images, press the left arrow key.
  • Pressing Enter in response to the final question will end the outer loop (the one that takes you back to the images).

Hope this helps.


repeatImages.psyexp (16.3 KB)
images.xlsx (8.5 KB)
questions.xlsx (8.5 KB)

1 Like

Thank you so much for your example!
I tried adapting what you sent me to my experiment. However, after I see all the pictures, they experiments suddenly ends. I can’t even see the questions. Not sure why this is happening.

  • Are you using the most recent PsychoPy version?
  • Did you make sure to put the Excel file with the questions in the same folder as the other files?
  • Are there any error messages?


the problem was with the code, but I was able to find and fix it.
Now it is working perfectly! Thank you so much for your help!

Glad it works now! Feel free to describe the issue you had with the code. It worked fine on my system, but I can’t exclude the possibility that I accidentally uploaded the wrong version of the experiment.


The problem with the code was actually my mistake, I forgot one letter so it was not reading. I fixed it and now it is running. The only problem that I’m having now is that when I want to move to the next routine, outside of the loop, it does not let me. It goes back to the pics again, and then the questions again.

Sorry, do you mean that the version I posted has this issue or this issue appears after you’ve made changes to the experiment?