# Python class Point.draw() not working

**URL:** <https://forum.codewithmosh.com/t/python-class-point-draw-not-working/5505>\
**Category:** Python\
**Created:** [June 14, 2021, 4:24am UTC](https://forum.codewithmosh.com/t/python-class-point-draw-not-working/5505 "2021-06-14T04:24:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pythonrob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/pythonrob/32/1767_2.png) [@pythonrob](https://forum.codewithmosh.com/u/pythonrob)\
**Post date:** [June 14, 2021, 4:24am UTC](https://forum.codewithmosh.com/t/python-class-point-draw-not-working/5505/1 "2021-06-14T04:24:46Z")

</div>

I’m getting this error: AttributeError: ‘NoneType’ object has no attribute ‘draw’

Can anyone explain why I am seeing this error? Thanks.

My code is below:  
class Point:

```
def __init__ (self, x, y):

    self.x = x

    self.y = y

@classmethod

def defaults(cls):

    cls(1, 2)

def draw(self):

    print(f"Point ({self.x}, {self.y})")

```

robert = Point.defaults()

robert.draw()

---

<div class="post-metadata">

**Author:** ![AzharUddinSheikh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/azharuddinsheikh/32/5561_2.png) [@AzharUddinSheikh](https://forum.codewithmosh.com/u/AzharUddinSheikh)\
**Post date:** [June 17, 2021, 7:23am UTC](https://forum.codewithmosh.com/t/python-class-point-draw-not-working/5505/3 "2021-06-17T07:23:41Z")

</div>

fix your code you have forgot to use return keyword

@classmethod  
def defaults(cls):  
return cls(1, 2)
