Hey guys, I'm trying to learn how to use classes and work with seperate files, and I been reading about it and now I tryed making a little short "Hello World" thingy but I don't really understand the self. things, I thought I did but it's not working so I guess I diden't
Heres the code anyways:
HelloWorld.py
class HelloWorld :
def __init__(self):
print("Hi")
def Talk(self ,name):
self.nameA = name
print("Hello",self.nameA)
Main.py
import HelloWorld
HelloWorld.HelloWorld.Talk("Kevin")
I get the error:
Traceback (most recent call last):
File "D:\PygameSpel\Test med klasser\Main.py", line 3, in <module>
HelloWorld.HelloWorld.Talk("Kevin")
TypeError: Talk() takes exactly 2 arguments (1 given)
what am I missing?