define a File class and make getFile a method.
class File:
def __init__(self):
self.filename=None
def getFile(self):
self.filename=filedialog.askopenfilename()
file = File()
then command=file.getFile
Now file.filename should contain the return value of askopenfilename