I'm currently working on a simple file transfer program in Python. I am having trouble with the function for prompting the user for the location of the folder to be copied.
def getSrc():
if getSrc.has_been_called is False:
source = askdirectory()
getSrc.has_been_called = True
return source
else:
return source
getSrc.has_been_called = False
The variable source comes up as an unresolved reference. I understand that the variable must be initialized again due to the scope of an if-else statement, but I am unsure of how to save the directory in the source variable without the user being prompted for the directory again.