Help using pygame sprite to move a group of objects

I’m writing a game where I need a bunch of aliens to move across the screen whilst the player shoots them down. I can make individual aliens move, but I want to control the aliens as a group. My code is given below, with the portion creating a sprite group and moving them, commented out, as they don’t work.
Can anyone point out what I’m doing wrongly with the sprite group, as I try to modify the x property of the aliens?
I know I can extend the Sprite class and make the aliens as a subclass, and control them that way, but I’m trying to understand the sprite class as a standalone within my main program. Sorry, it may not be best practice, but that’s how I learn.

import sys
import pygame
from pygame.sprite import Sprite

class AlienInvasion:
    """Overall class to manage game assets and behaviour"""

    def __init__(self):
        """Initialize the game, and cteate game resources"""

        self.screen = pygame.display.set_mode((1200, 800))
        self.screen_rect = self.screen.get_rect()
        self.screen.fill((230, 230, 230))
        pygame.display.set_caption("Alien Invasion")
        self.image = pygame.image.load('images/ship.bmp')
        self.rect = self.image.get_rect()
        self.rect.midbottom = self.screen_rect.midbottom
        self.screen.blit(self.image, self.rect)
        self.alien = pygame.image.load('images/alien.bmp')
        self.alien_rect = self.alien.get_rect()
        self.screen.blit(self.alien, self.alien_rect)
        self.alien1 = pygame.image.load('images/alien.bmp')
        self.alien1_rect = self.alien1.get_rect()
        self.alien1_rect.x = 0
        self.alien1_rect.y = 200
        self.screen.blit(self.alien1, self.alien1_rect)
        self.aliens = pygame.sprite.Group()
        self.alien = pygame.sprite.Sprite() #create a sprite instance
        self.alien1 = pygame.sprite.Sprite()

    def run_game(self):
        """Start the main loop for the game"""
        while True:
            # Watch for keyboard and mouse events
            for event in pygame.event.get():
                if event.type == pygame.QUIT:

            #Make alien move to right
            self.screen.blit(self.alien, self.alien_rect)
            self.alien_rect.x += 1
            self.screen.blit(self.alien1, self.alien1_rect)
            self.alien1_rect.x += 1
            for alien in self.aliens.sprites():
                alien.x += 1

            #Make the most recently drawn acreen visible

if __name__ == '__main__':
    # Make a game isntance, and run the game
    ai = AlienInvasion()

What exactly does this mean?
What happens when you try using that version of the code, and how is that different from what you expect?
When you try using this approach, do you also remove the other way of moving the aliens?
When you try using this approach, do you also change the drawing code so that it draws the group (or sprites within the group), rather than the rects?

My advice to you is: don’t try to work with two different “versions” of the code in the same source file. Instead, learn to use a version control system, such as Git; make sure you have committed the “working” version (in this case, the one just using Rects), and then replace that approach with the new one that you’re trying. If and when it goes wrong, you can then show and debug the non-working version independently, and use your version control system to recover the older working version if necessary.

Hi Karl,

Thanks for the advice. I’ll try using github version control. Here’s the non-working codes, and the error messages received.

Error message:

Exception has occurred: AttributeError