In Python, I\'m trying to run a method in a class and I get an error:
Traceback (most recent call last):
File \"C:\\Users\\domenico\\Desktop\\py\\main.py\"
In Python 2 (3 has different syntax):
What if you can't instantiate your Parent class before you need to call one of its methods?
Use super(ChildClass, self).method() to access parent methods.
class ParentClass(object):
def method_to_call(self, arg_1):
print arg_1
class ChildClass(ParentClass):
def do_thing(self):
super(ChildClass, self).method_to_call('my arg')