Hey so i’m trying to make a game hub where it lists the games in numbers. (1,2,3,4,5,6)
Say i type “2”, I want “2” i want “2” to be associated with running
( i already got the game hub setup, I just need to figure out how to run a py project from another py project"
maybe “py tictactoe” how would i do this?
Here is the code for my game hub if you are interested.
from colorama import Fore, Style
print("""
┌────────────────────────────────────────────────────────────────┐
│ _ _ _ _ │
│ / \ _ __ (_) __ __ | |_ ____ ___ _ __ ( ) ___ │
│ / _ \ | '_ \ | | \ \/ / | __| |_ / / _ \ | '__| |/ / __|│
│ / ___ \ | | | | | | > < | |_ / / | __/ | | \__ \│
│/_/ \_\ |_| |_| |_| /_/\_\ \__| /___| \___| |_| _ |___/│
│ __ _ __ _ _ __ ___ ___ | |__ _ _ | |__ │
│ / _` | / _` | | '_ ` _ \ / _ \ | '_ \ | | | | | '_ \ │
│| (_| | | (_| | | | | | | | | __/ | | | | | |_| | | |_) | │
│ \__, | \__,_| |_| |_| |_| \___| |_| |_| \__,_| |_.__/ │
│ |___/ │
└────────────────────────────────────────────────────────────────┘
""")
print(f"{Fore.LIGHTWHITE_EX}{Style.BRIGHT}Welcome to my game hub, Please select a game to play!")
print("""
┌───___──────────────────────────────────┐
│ / ___| __ _ _ __ ___ ___ ___ │
│| | _ / _` | | '_ ` _ \ / _ \ / __|│
│| |_| | | (_| | | | | | | | | __/ \__ \│
│ \____| \__,_| |_| |_| |_| \___| |___/│
└────────────────────────────────────────┘""")
game_list = {"1." : "RockPaperScissors",
"2." : "Cat quiz",
"3." : "Computer quiz",
"4." : "Salary classer",
"5." : "Carp sizer",
"6." : "%Under development%",
" " : " "}
for key, value in game_list.items():
print(key, value)
player_input = input("Select a numbered associated with a game to play that game!")
if player_input == "1" :
# this is where im stuck. cant figure out how to run a py file from here. Looking for something like py.run ( file path )