Session Events in designer startUp not running

Hi,
So I try to make a startup session event, but every time I start my project it doesn’t run and it has a compiling error. In my perspective session property editor I have a custom value called operatorBlock and sometimes it just disappears. I try to make a session event on startup to generate this value, but I can’t really get it to work.

Anyone got some advice?

def onStartup(session):
session.props.locale = "en-US"	
print("Locale (Language) is in English now (en-US)")


if 'operatorBlock' in session.custom:
		operatorBlock = session.custom.operatorBlock
		print(operatorBlock)
else:
	session.custom.operatorBlock = "OperatorStartUp"

Is this an exact copy of the working version of the code? If so, be sure to indent your code correctly:

def onStartup(session):
    session.props.locale = "en-US"	
    print("Locale (Language) is in English now (en-US)")


    if 'operatorBlock' in session.custom:
    		operatorBlock = session.custom.operatorBlock
		    print(operatorBlock)
    else:
	    session.custom.operatorBlock = "OperatorStartUp"

If this still doesn’t work, try:

self.session.props.locale

Could you try adding a logger and seeing if this script runs at all?

system.util.getLogger | Ignition User Manual