I am trying to import a python script (graphics.py) into my other script (game.py), however, it's not working.
In game.py:
import pygame
import graphics.py
import sys # Mainly for sys.quit
"""********Start variables********"""
# Some colour constants
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
BLUE = ( 0, 0, 255)
# Display settings
FPS = 60
fpsClock = pygame.time.Clock()
def main():
pygame.init()
# Load graphics
gfx = graphics()
And in graphics.py:
import pygame
class graphics(object):
# Create a surface that will hold the player sprite
SprPlayer = pygame.Surface((32, 32))
# At the beggining of the object, load the sprites
def __init__():
SprPlayer = pygame.image.load("Graphics\Player.png")
So I'm making my first python game, (Python is my new favorite language other than GML.) and I can't have everything in one file. Here is the error
import graphics.py
ImportError: No module named py
I have both scripts in the same directory, so I don't know what's going on. Any help is greatly appreciated.