In Qgis when I add the following code in a .py file and try to reload it in QGIS:
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
print(file_path)
throws this: ModuleNotFoundError: No module named '_tkinter'
But when I create a .py file with the same instructions and then I execute the program, there is no issue, the program open a window. Why? I have been searching but none of the answers works for me.