Keyerror: if expInfo['order']=='random':

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
I am trying to use open source code to build an Implicit association test on psychopy. As the first step, I simply had to create instructions heading. The code is given below:

if expInfo['order']=='random':
    expInfo['order'] = randint(1,2)
    
blocks_file = "blocks_order"+str(expInfo['order'])+".xlsx"

However, When i try to run this block, it shows the error;
Traceback (most recent call last):

  File "C:\Users\abhin\OneDrive\Desktop\PsychopyIAt_lastrun.py", line 85, in <module>
    if expInfo['order']=='random':
KeyError: 'order'

Please help!

Is order in your expInfo dialogue box?