Clicker game bug

i tried making a clicker and now worked on it 3 hours not finding the problem, the program works once but the second button doesn’t work after one click, and i cant find the error, the boutton 2 doesn’t make any effect anymore

from tkinter import *

points = 1
allpoints = 10000
price = 10
intprice = 0

def button():
global upgrade
global Clickme
global template
global price
global points
global allpoints
upgrade = Button(window, text = “Upgrade clicks for " + str(price) + " points”, command=upgrade).grid(row= 4)
Clickme = Button(window, text = “click to get " + str(points) + " points”, command=add).grid(row= 0)
template = Label(window, text = str(allpoints)).grid(row = 1)

def add():
global points
global allpoints
allpoints += points
template = Label(window, text = str(allpoints) + " points").grid(row = 1)

def upgrade():
print(“upgrade”)
global points
global allpoints
global price
if int(allpoints) >= int(price):
allpoints -= int(price)
points = int(points2)
price = int(round(price
2.2))
button()
print(“if”)
else:
print(“else”)

window = Tk()

button()

window.mainloop()

i tried multiples ways to spot where it dies, i noticed it disables at the button itself
< command=upgrade >

i traced it to there using the print command, i have also tried to replicate it, but i couldn’t.

okay i fixed it after fiddling around lol