import tkinter as tk
is the preferred way of importing, see https://python-forum.io/Thread-Namespace...th-importsyou should only need one
root.mainloop()
The error is because you are trying to use
from tkinter import *
inside a functionImports should go at the start of your python file.
It looks like you have put two separate windows codes together in a way which they shouldn't be.