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__()
It's easier to ask forgiveness than to ask permission.
Don't check to see if a method exists. Don't waste a single line of code on "checking"
try: dyn.mymethod() # How to check whether this exists or not # Method exists and was used. except AttributeError: # Method does not exist; What now?