Python, tkinter: How to select a directory then load the path as a variable to an imported class?
Question: I am developing a gui in which the user has to browse choose the a directory.
Then I need the directory path to be saved as a variable and used by an
imported class.

So far I have written the code that enables a user to pick a directory but am
not stuck as what to do next. The code I have so far is below:

    
    
    def loadDirectory():
        directory = filedialog.askdirectory()
    

the function is called by pushing a button.

Thanks in advance


Answer: This is relatively simple.

    
    
    import chrome
    
    def loadDirectory():
        chrome.directory = filedialog.askdirectory()
    

This should do what you want.

