How do I call a parent class’s method from a child class in Python?

Use the super() function:

class Foo(Bar):
    def baz(self, **kwargs):
        return super().baz(**kwargs)

For Python < 3, you must explicitly opt in to using new-style classes and use:

class Foo(Bar):
    def baz(self, arg):
        return super(Foo, self).baz(arg)

Leave a Comment