I'm attempting to import a class called "Settings" into a pygame code.
The calling code
import sys # used to exit game when user is done
import pygame
from settings import Settings
def run_game():
#initialize game and create screen object
pygame.init()
ai_settings = Settings()
screen =pygame.display.set_mode((1200, 800))
The settings.py file
#settings for alien_invasion
class Settings():
"""A class to store all settings for Alien Invasion"""
def _init_(self):
#intialize games settings
self.screen_width=1200
self.screen_height=800
self.bg_color=(230,230,230)
I'm aware that this is likely a syntax error, but I've searched around and can't quite find what I'm doing wrong.
The exact error that I'm getting is
AttributeError: 'Settings' object has no attribute 'screen_width'