call parenty class methods python code example
Example 1: call a function from another class python
class A:
def method1(arg1, arg2):
# do code here
class B:
A.method1(1,2)
Example 2: python call function in the same class
# Add the argument ".self" before your function's name --> line 12
class ThisClass:
def __init__(self):
self.a_random_arg = a_random_arg
def FirstDef(self):
[Here my function]
def SecondDef(self):
if self.FirsDef:
[following]