Im trying to use global variables in order to declare them at the start of my code just like you would in C# however when ever i edit them in a function and i try call it in another function it throws an error saying that the variable is not declared?
This is where i declare the variables:
from tkinter import *
import os
global Name
global Wmain
global directory
global Username
global Password
global Code
This is where i change the the directory variable:
def NameGet():
    Name = NameEntry.get()
    directory = ('C:\\Users\\Bradley\\Desktop\\Log In system\\Members\\' + Name + '.txt')
    CheckFile(Name)
This is where i am getting the error:
def SignUpFinished():
    with open(directory, W) as F:
        F.write(Username)
        F.write(Password)
        F.write(Code)
        F.close()
Now i feel im either making a really novice mistake or something isnt working right with my code. any ideas?
 
    