In the function __getattr__(), if a referred variable is not found then it gives an error. How can I check to see if a variable or method exists as part of an objec
__getattr__()
If your method is outside of a class and you don't want to run it and raise an exception if it doesn't exist:
'mymethod' in globals()