I have two files: sprites.py
and test.py
. In sprites.py
, I made a Player
class. I imported everything into the main
file (test.py
) using from player import *
.
sprites.py
:
import pygame
from test import *
class Player(pygame.sprite.Sprite):
# ...
pass
test.py
:
import pygame
from sprites import *
# ...
all_sprites = pygame.sprite.Group()
player = Player() # <-- line 28, NameError
all_sprites.add(player)
I get this error:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from sprites import *
File "C:\Users\Adam\Desktop\PYthon Test\sprites.py", line 2, in <module>
from test import *
File "C:\Users\Adam\Desktop\PYthon Test\test.py", line 28, in <module>
player = Player()
NameError: name 'Player' is not defined
I have already ensured that I have everything spelt correctly. Where could this error be coming from?