like I have a file first.py
from tkinter import *
import second
if __name__ == "__main__":
root = Tk()
text_url = StringVar()
e1 = Entry(root, width=50, justify=CENTER, textvariable=text_url)
e1.insert(0, 'Enter your URL')
e1.pack(pady=(300, 0))
b1 = Button(root, text="SEARCH", justify=CENTER, bg='#900c3f', width=12, fg="white", height=1, relief=GROOVE,font="verdana", command=second.get_search)
b1.pack(pady=60)
root.mainloop()
and I have second file name second.py
from first import *
def get_search():
u = text_url.get()
return u
print(get_search())
I want to access text_url from first.py in my second.py, but when i run this code
NameError: name 'text_url' is not defined
I get this error can anyone help me to understand what's wrong is it the issue due to variable scope or due tkinter ? cause without tkinter I can call the variable easily but with tkinter i just can't.