In one function I get three pieces of information and write them to a text file. In another function I write over one of the pieces of information (Code).
The variables FirstName, SecondName, Code from function1 are not known by function2 - how do I solve this? / Pass them from one function to another?
def function1():
    FirstName = input("Enter First Name")
    SecondName = input("Enter Surname")
    Code = input("Enter Code")
AllDetails = (GuestFirstName, GuestSecondName, Code)
f = open("AllDetails.txt","w") 
f.write(str(AllDetails))    
f.close()
menu()
def function2():           
    Newcode = input ("Enter if new code needed")
    if Newcode == "Y":
        Code = "****"
        AllDetails = (FirstName, SecondName, Code)
        f = open("AllDetails.txt","w") 
        f.write(str(AllDetails))
        f.close()
menu() 
 
     
    