Reputation: 1
class myClass(object):
def __init__(self, firstVar):
'''
Some docstring
'''
self.var = firstVar
def myProcedure1(self, secondVar):
'''
Some docstring1
'''
return my_thing
def myProcedure(self, secondVar):
'''
Some docstring2
'''
what_I_Need = myClass.myProcedure1(secondVar)
do something with this
return something else
When I call myClass_instance.myProcedure(secondVar)
I get a error saying that:
TypeError: myProcedure1() missing 1 required positional argument: 'secondVar'
How can I pass secondVar
to make this work?
Upvotes: 0
Views: 38
Reputation: 1123400
You are calling the method directly on the class, which is unbound. That means no self
is passed in, and secondVar
is interpreted as the value for self
instead.
Call the method on self
:
self.myProcedure1(secondVar)
self
here is just another reference to the instance, just like myClass_instance
is when you call myProceduce(...)
on that object.
Upvotes: 1