'Want to know how to have game1.py, run game1a.py once level is completed (code attached)

When completing a stage in game1, I want the code to now progress and open game1a.py and continue playing till completed, then move onto game1b.py

I also want in game1a.py or game1b.py that if I loose it take me back a game level e.g game1a.py back to game1.py, game1b.py to game1.py and run the game without having to run the command 'python3 game1.py' again, unless the user chooses to exit.

I am a beginner and have watch a number video's and reviewed comments, but still having trouble understanding the code requirements.

#My code message_display, which then should open and run game1a.py#

import file ('game1a.py')

def message_display_wh(text): largeText = pygame.font.Font('freesansbold.ttf', 40)
TextSurf, TextRect = text_objects(text, largeText)
TextRect.center = ((display_width/2),(display_height/2))
gameDisplay.blit(TextSurf, TextRect)

pygame.display.update()   

time.sleep(1)

#require code here to enter game1a.py now that the user has completed the level.

any help would be greatly appreciated.



Sources

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

Source: Stack Overflow

Solution Source