Use classmethod:
class B(object):
@classmethod
def other(cls, arg1, arg2):
print "I am function class B"
class A(object):
def funct(self, arg1, arg2):
B.other(arg1, arg2)
A().funct(1,2)
===>I am function class B
Use staticmethod:
class B(object):
@staticmethod
def other(arg1, arg2):
print "I am function class B"
class A(object):
def funct(self, arg1, arg2):
B.other(arg1, arg2)
A().funct(1,2)
===>I am function class B
Some references about staticmethod and classmethod.
Instantiate B inside A class
class B(object):
def other(self, arg1, arg2):
print "I am function class B"
class A(object):
def funct(self, arg1, arg2):
B().other(arg1, arg2)
A().funct(1,2)
===>I am function class B
You could use Python Inheritance.
class B(object):
def other(self, arg=None):
print "I am function class B"
class A(B):
def funct(self, arg1, arg2):
self.other()
a_class_object = A()
a_class_object.other()
===>I am function class B
Also din't forgive to add self
argument to class methods.
You can find out more information about Inheritance in off. Python docs