I am creating a game using pygame, and separed it into many modules. I have added a new one for displaying the gamer's stats.
After setting up a basic pygame window, I tried to run the main code, but when I tried to open the stats window, I got an error telling me that my module (stat), hasn't an attribute named main: my main function in the module (but it does !).
I tried after that to import the main function by an other way : from stat import main, but it told me afterwards that python is not able to import the module stat.
I tried to modify the recurion limit to, but nothing changed...
So I hope that someone could help me, and here is how I'm importing the module :
from stat import main as stat
This is how it is used in my code:
if 190 <= mouse[0] <= 390 and 180 <= mouse[1] <= 240:
    color_3 = YELLOW
    if click[0] == 1:
        stat(window)
else:
    color_3 = BLACK
And here is almost all what ther is in my stats module (I did'nt added some global variables, and the pictures loading)
def main(window):
    global stat_count, stat
    pygame.dispaly.set_caption('Your stats')
    while stat:
        stat_count +=1
        if stat_count >= 27:
            stat_count = 0
        events = pygame.event.get()
        
        for event in events:
            if event.type == pygame.QUIT:
                pygame.quit()
        draw(window)
        clock.tick(27)
    def main(window):
    global stat_count, stat
    pygame.dispaly.set_caption('Your stats')
    while stat:
        stat_count +=1
        if stat_count >= 27:
            stat_count = 0
        events = pygame.event.get()
        
        for event in events:
            if event.type == pygame.QUIT:
                pygame.quit()
        draw(window)
        clock.tick(27)
def draw(window):
    global stat_count
    window.fill(BLUE)
    window.blit(bg[stat_count//3], (0, 100))
    pygame.display.update()
