I installed pygame in my project folder (the folder where the script gets executed) because I don't want the user to download the requirements or run a setup file. First I tried installing pygame in the project folder and importing it with import pygame and everything went as expected.
To install it in the lib folder I used the following command:
pip install --target=...\project-folder pygame
But when I tried installing pygame in a 'lib' folder, and importing it with
from lib import pygame
or
import lib.pygame as pygame
it doesn't work and it gives the following error:
from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
ModuleNotFoundError: No module named 'pygame'
I noticed a lot of simple games have a 'lib' folder but I don't understand how they do it.