I've written a simple game that compares a lucky number solicited from the user to a simulated dice roll. I've managed to add a scoring feature as well, but now I want to add a replay feature. The best way I can think to do this is with a "Replay" function. Here's what I've got:
import random
lucky_number = None
dice_roll = None
score = 0
def get_lucky_number():
    print("What's your lucky number?")
    global lucky_number
    lucky_number = int(input())
    while lucky_number > 6 or lucky_number < 1:
        print("Error! Try again!")
        get_lucky_number()
def roll_dice():
    global dice_roll
    dice_roll = random.randrange(1, 7, 1)
    print("Your lucky number is " + str(lucky_number) + "!")
    print("Your dice rolled a " + str(dice_roll) + "!")
def score_and_output():
    if lucky_number == dice_roll:
        global score
        score = score + 1
        print("You won! Your score is " + str(score) + "!")
    else:
        print("You lose! Your score is " + str(score) + "!")
def replay():
    play_again = input("Would you like to play again? Type 1 if Yes, 2 if No!")
    if play_again == 1:
        game()
    else:
        quit()
def game():
    get_lucky_number()
    roll_dice()
    score_and_output()
    replay()
game()
Problem is, the game() function doesn't yet exist when called by replay(). How do I get around this?
 
    