How to randomize blocks using custom code?

I have created an experiment that imports the stimuli using xlrd
I do this so that each participants will have different set of stimuli but with the same subcategory pairings divided in 3 blocks
which means I have no condition files for any of my blocks
since I am using custom code throughout the experiment, is there a way to randomize the block order per iteration?

I have 3 blocks and want them to repeat three times.
At first it will run sequentially, that’s fine, but is there a way to randomize the order of the block once it reiterates? for example
1st iteration 1-2-3
2nd iteration 2-1-3
3rd iteration 3-2-1

because I noticed that using custom code makes the loop properties in the builder not usable.

Thank you in advance.