I'm learning python. I have created a class visualizer which contains 2 methods. Now I want to call the first method inside my second method. I read I have to use self:
def method2(self):
self.method1()
This works. Now I'm adding additional parameters:
def method2(self, param1, param2, param3):
self.method1()
And I call it from my main.py
:
xx.method2(param1, param2, param3)
Now I get an error:
missing 1 required positional argument: 'param3'
I checked, param3 is there and the sequence of parameters is the same. I think it's conflicting with self
.
How can I solve this? Do I need an init method inside my class?
EDIT: In my Main:
from project.visualizer import Visualizer
vsl = Visualizer
vsl.method2(param1, param2, param3)