I have the following problem: I want to import a variable from one file into another. But when the file from which I import has a tkinter window, it opens the entire window instead of just importing the variable. How do I solve this ?
Code from file1
from tkinter import *
root = Tk()
A = "This is "
B = "a test."
C = A+B
D = Label(root, text=C, font="Arial 20 bold")
D.pack()
root.mainloop()
Code from file2
from file1 import C
print(C)