In my school project I have to make global "list of clients" function so i dont have to open my files everytime i need something from this file in other functions. Here it says that client_list is not defined:
global client_list
def clients():
    client_list = []
    with open("svi.txt","r") as f:
        every_part = ["username","password","name","lastname","role"]
        for r in f.readlines():
            dicct = {}
            bla = r.strip().split("|")
            count = 0
            for i in bla:
                dicct[every_part[count]] = i
                count += 1
            client_list.append(dicct)
def log(file_path,user,password,delimiter):
    for r in client_list:
        n = r.strip().split(delimiter)
        username = n[0]
        passwordd = n[1]
        role = n[4]
        while username == user and passwordd == password:
            if role == "buyer":
                return buyer_menu2()
            elif role == "manager":
                return menager_menu2()
            elif role == "seller":
                return seller_menu2() 
    return False
def login():
    x = False
    while x == False:
        user = input("Username: ")
        password = input("Password: ")
        x = log("svi.txt",user,password,"|")
        if x == False:
            print()
            print("Wrong username or password, please try again. ")
            print()
    print()
login()
 
     
    