# Once you have saved your .py file, import pygame import pygame, sys from pygame.locals import * # This is function call which you must always call after importing pygame. pygame.init()