if 'variavel' in locals():

if 'variavel' in globals():

if hasattr(objeto, 'variavel'):
    
#https://pt.stackoverflow.com/q/50206/101

if 'variavel' in locals():

if 'variavel' in globals():

if hasattr(objeto, 'variavel'):
    
#https://pt.stackoverflow.com/q/50206/101

#https://pt.stackoverflow.com/q/50206/101