So, I am working to familiarize myself with object-oriented programming by teaming with classes in python. Below is a simple code that I [tried] to implement only in the interpreter.
class Test(object): def set_name(self, _name): name = _name def set_age(self, _age): age = _age def set_weight(self, _weight): weight = _weight def set_height(self, _height): height = _height
When I run python, I run the following commands:
>>>import Test >>>Test.set_name("Sean")
and then I get this trace:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'set_name'
I base all of this on the official module documentation found here .
I read quite a lot of OOP documentation, but I'm still very new to it, so I'm sure something is still happening right above my head. What does this error mean?
Thanks in advance for your help.
source share