I saved my variables at the start of my program and allow the functions to access them I believe but when they run the value is not saved when the function repeats.
P1_score = 0
P2_score = 0
round_number = 0
def dice_rolling():
    # P1D1 means player ones dice one value and so on with P1D2
    import random
    # player ones turn
    print("player ones turn")
    P1D1 = random.randint(1, 6)
    print("your number is ", P1D1)
    P1D2 = random.randint(1, 6)
    print("your second number is", P1D2)
    # player twos turn
    print("player twos turn")
    P2D1 = random.randint(1, 6)
    print("your number is", P2D1)
    P2D2 = random.randint(1, 6)
    print("your second number is", P2D2)
    score_calculation(P1D1, P1D2, P2D1, P2D2,P1_score,P2_score,round_number)
def score_calculation(P1D1, P1D2, P2D1, P2D2,P1_score,P2_score,round_number):
    import random
    
    round_number = round_number + 1
    # player 1 score calculation
    total_P1 = P1D1 + P1D2
    P1_score = P1_score + total_P1
    if total_P1 % 2 == 0:
        P1_score = P1_score + 10
    else:
        P1_score = P1_score + 5
    if P1D1 == P1D2:
        P1D3 = random.randint(1, 6)
        P1_score = P1_score + P1D3
    # player 2 score calculation
    total_P2 = P2D1 + P2D2
    P2_score = P2_score + total_P2
    if total_P2 % 2 == 0:
        P2_score = P2_score + 10
    else:
        P2_score = P2_score + 5
    if P2D1 == P2D2:
        P2D3 = random.randint(1, 6)
        P2_score = P2_score + P2D3
    print("player ones score at the end of round", round_number, "is", P1_score)
    print("player twos score at the end of round",round_number,"is",P2_score)
    
for x in range(0,5):
    dice_rolling() 
Any help would be appreciated and if someone could give a simple explanation as to what I'm doing wrong and what to fix would be great.
 
     
     
    