how to call a function in a class python code example

Example 1: python call function in class

#------------------------------------
#CLASS
#------------------------------------
class Student:
  def __init__(self):
    self.name = None
    
  def set_name(self, word):
    self.name = word
    return self.get_name()
    
  def get_name(self):
    return self.name
  
#------------------------------------
# USAGE:
#------------------------------------

a = Student()
print(a.set_name("Hello"))

Example 2: call a function from another class python

class A:
    def method1(arg1, arg2):
        # do code here

class B:
    A.method1(1,2)