class Alpha:

    def __init__(self):
        self.a = 10
self.b = 100
alpha = Alpha()
print(alpha.a)
print(alpha.b)

def foo(self):
    print(self.a * self.b * self.c)
Alpha.c = 1000
Alpha.d = foo
beta = Alpha()
beta.d()
Dynamically adding methods with or without metaclass in Python