'pygame.examples.aliens not working (syntax error)

If i try to run the example code "python3 -m pygame.examples.aliens" i get a syntax error (see code bellow). I thought that i didn't install pygame correctly but i don't get an error when i type import pygame. So i think it should be installed and working.

import pygame
pygame 2.1.2 (SDL 2.0.18, Python 3.10.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
python3 -m pygame.examples.aliens
SyntaxError: invalid syntax

Thank you for trying to help!



Solution 1:[1]

From what i see the problem is that you're actualy suposed to run the command in your terminal and not in the python intrepeter. So just open a new terminal and type the command there

Solution 2:[2]

I was having the same problem until I closed the terminal and opened a new one lol

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Imaduk