call instance class python code example
Example: call instance class python
# define class
class example:
# define __call__ function
def __call__(self):
print("It worked!")
# create instance
g = example()
# when attempting to call instance of class it will call the __class method
g()
# prints It worked!