I have a program that I'm just adding graphics to, but I'm having trouble running my main code along with the graphics. Basically I have something like this:

```
def mainFunction():
    while True:
        run code in here

root = Tk()
board = Canvas(root, height=710, width=1000)
board_image = PhotoImage(file="/path/example.jpg")
photo = board.create_image(0,0, anchor=NW, image=board_image)
board.pack()

mainFunction
root.mainloop()

```

I can only run either the mainFunction or the graphics because whichever one I make run first in the code is the only that runs. It doesn't stop to allow the next code to run. There has to be a simple way to get graphics and code to run together side by side. Thanks!