from tkinter import *
from tkinter.ttk import *

def neww():
    def test2():
        print(var2.get())
        
    root2 = Tk()
    var2 = IntVar(value=1)
    check2 = Checkbutton(root2, text='Test2', variable=var2, command=test2)
    check2.pack()

def test():
    print(var1.get())

root = Tk()
var1 = IntVar(value=1)
check1 = Checkbutton(root, text='Test', variable=var1, command=test)
check1.pack()
neww()
root.mainloop()
