I have a python class which has multiple methods. I have defined my methods via @staticmethod
instance and I want to call other methods of my class from inside my main function(main_function
). I think I need self
parameter for calling my other functions from my main function and I want to pass this parameter to my main_function
when I create an instance of my class.
class myclass:
@staticmethod
def function1(param1)
print "function1"
@staticmethod
def main_function(self, param1)
function1(param1)
my_object = myclass()
my_object.main_function(param1)
I got this error:
TypeError: main_function() takes exactly 2 arguments (1 given)
The problem is that I have not self
parameter when I create my instance. I tried to remove @staticmethod
keyword from my method definition and remove all self
parameter using, but this does not work.