human
check if a variable exists
assistant
Here is some code to check if a local variable 'myVar' exists

if ('myVar' in locals()):
    pass

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.