Oct-30-2019, 07:58 PM
Two issues. As above, need self in the function definition. Next, you need an ab object in order to call the function. The class is just a template. So, in the example below, we create the cab object of type ab, then call the function:
class ab: def a(self): print("in a") def b(): print("in b") if __name__ == '__main__': b() cab = ab() cab.a()
Output:in b
in a