class MyClass: var1 = 1 def update(value): MyClass.var1 += value def __init__(self,value): self.value = value MyClass.update(value)
You need to use the @classmethod decorator:
@classmethod
$ cat t.py class MyClass: var1 = 1 @classmethod def update(cls, value): cls.var1 += value def __init__(self,value): self.value = value self.update(value) a = MyClass(1) print MyClass.var1 $ python t.py 2