编写外星人入侵程序时出现object has no attribute 'screen'错误,如何解决?(语言-python)

如题。
调试很久也不知道问题出自哪里,代码如下:
import pygame
import sys

class Settings:

def __init__(self):
    self.screen_width = 800
    self.screen_height = 800
    self.bg_color = (230, 230, 230)

class Ship:

def __init__(self, ai_game):
    self.ship_image = pygame.image.load("D:\python\ship.bmp")
    self.ship_rect = self.ship_image.get_rect()
    self.screen = ai_game.screen
    self.screen_rect = ai_game.screen.get_rect()
    self.ship_rect.midbottom = self.screen_rect.midbottom

def show(self):
    self.screen.blit(self.ship_image, self.ship_rect)

class AlienInvasion:

def __init__(self):
    pygame.init()
    self.ship = Ship(self)
    self.settings = Settings()
    self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
    pygame.display.set_caption("飞机大站")

def check_events(self):
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()

def update_events(self):
    self.screen.fill(self.settings.bg_color)
    pygame.display.flip()

def run_game(self):
    while True:
        self.check_events()
        self.ship.show()
        self.update_events()

ai = AlienInvasion()
ai.run_game()


self.ship = Ship(self)
self.settings = Settings()
self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
#这个Ship没有传入screen,改成
self.settings = Settings()
self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
self.ship = Ship(self)