How to Solve NameError: name 'filedialog' is not defined -- tkinter
Solution: Import the 'filedialog' module
To Solve the error, add the following line to the top of your code.
from tkinter import filedialog
For more information:
Python filedialog tkinter