textvarible that is created in click function for entry box is not printing any thing in function d. i.e on call to function d(), a.get() is empty. Why is this not printing?
I tried threading these two click() and d() function, but nothing works 
from tkinter import *
def click():
    def d():
        print(a.get())
    w2=Tk()
    a=StringVar()
    E=Entry(w2,textvariable=a).pack()
    b=Button(w2,text="submit",command=d).pack()
w=Tk()  
b=Button(w,text="ok",command=click).pack()
mainloop()