is there a way to get a new image to display using a function inside of a function?

I'm doing a project for school and I have no clue as to why this isn't working. Any help is appreciated!

from tkinter import *

def main():
    def change():
        photo2 = PhotoImage(file=r"image2")
        label.configure(image = photo2)

    mainwindow.destroy()
    window = Tk()
    window.geometry("1500x1500")
    photo1 = PhotoImage(file = r"image1")
    label = Label(window, image = photo1)
    label.place(x = 20, y = 20)
    button = Button(window, text = "Click Me!", command = change)
    button.place(x = 0, y = 0)
    window.mainloop()

mainwindow = Tk()
mainwindow.geometry("700x700")
start = Button(mainwindow, text = "start", command = main)
start.place(x = 0, y = 0)

mainwindow.mainloop()
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum