# Error - Class 'SpriteKind' used before its declaration

**URL:** https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219
**Category:** Arcade
**Created:** [October 16, 2024, 11:53pm UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219 "2024-10-16T23:53:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jovanazekanovic](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jovanazekanovic](https://forum.makecode.com/u/jovanazekanovic)
#### Post date: [October 16, 2024, 11:53pm UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219/1 "2024-10-16T23:53:18Z")

</div>

Hi everyone!  
I’m having this issue with an error for my player sprite. I’ve tried fixing it and trying different Python codes to fix it and nothing is working. Does anyone know how to fix this?

Thank you!

 ![Screenshot 2024-10-17 at 10.50.43 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/0/a060a093c6bf41fc76f78d676944728eb8da1a35.png)  
 ![Screenshot 2024-10-17 at 10.50.26 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/2/f2c644a02567317e2ec6740a8a40d478a3223679.png)

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [October 16, 2024, 11:54pm UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219/2 "2024-10-16T23:54:29Z")

</div>

@jovanazekanovic can you share a link to your project? Use the share icon in the top bar (between the home and question icons)

---

<div class="post-metadata">

### Author: ![jovanazekanovic](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jovanazekanovic](https://forum.makecode.com/u/jovanazekanovic)
#### Post date: [October 16, 2024, 11:58pm UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219/3 "2024-10-16T23:58:26Z")

</div>

> **[Princess and the Hidden Heirlooms](https://arcade.makecode.com/S89134-90636-64046-63872)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

here is the link 🙂

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [October 17, 2024, 12:03am UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219/4 "2024-10-17T00:03:13Z")

</div>

ah, looks like your `SpriteKind` declarations got messed up.

`SpriteKind` is a special class in MakeCode’s Python, it needs to have the `@namespace` decorator on it to work properly. Try changing your declaration from:

```python
class SpriteKind:
    bow = SpriteKind.create()
    crown = SpriteKind.create()
    ring = SpriteKind.create()

```

to

```python
@namespace
class SpriteKind:
    bow = SpriteKind.create()
    crown = SpriteKind.create()
    ring = SpriteKind.create()

```

the `SpriteKind` class is the only one you need to add that decorator on; all other classes can be coded just like you normally would in Python.

---

<div class="post-metadata">

### Author: ![jovanazekanovic](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jovanazekanovic](https://forum.makecode.com/u/jovanazekanovic)
#### Post date: [October 17, 2024, 11:46pm UTC](https://forum.makecode.com/t/error-class-spritekind-used-before-its-declaration/31219/5 "2024-10-17T23:46:39Z")

</div>

awesone thank you so much! that fixed the error for me 🙂
