Randomize image presentation without consecutive presentation

OS (e.g. Win10): Mac
PsychoPy version (e.g. 1.84.x): 2023.1.3
Standard Standalone? (y/n): y
What are you trying to achieve?:

I am trying to implement code that prevents the repetition of two images in a block. I am building a facial visualization task in which 6 faces are presented a total of 6 times each. I am okay with duplication within the block, but I want to prevent consecutive repetitions. I am using a conditional excel file to read these images in psychopy.

What did you try to make it work?:

I am unfamiliar with using the coding portion of PsychoPy so I wanted to come here for advice first. I believe the following article will be relevant in this problem, but I am confused as to how to replicate this solution for an image: Randomisation without consecutive presentations - #2 by Michael

Would I simply copy each individual path that I have in the Excel file per block? So my list would then be:

imageList = [‘/images/KDEF/AF01/AF01NES.jpg’, ‘/images/KDEF/AF02/AF02NES.jpg’, ‘/images/KDEF/AF03/AF03NES.jpg’, ‘/images/KDEF/AF04/AF04NES.jpg’, ‘/images/KDEF/AF05/AF05NES.jpg’, ‘/images/KDEF/AF06/AF06NES.jpg’]

Thanks in advance.

What specifically went wrong when you tried that?:
Have not tried the above solution yet, but planning on it.