title: Function responsible for opening and resizing photo does not work
body: <p>Im trying to pack code responsible for opening, resizing images into function as I will do this action a lot of times. 
  I have this couple of lines which are needed to show image in gui: </p>
  
  <pre><code>img = Image.open("images/cola.jpg")
  img = img.resize((40, 40), Image.ANTIALIAS)
  photoImg = ImageTk.PhotoImage(img)
  ColaLabel = ttk.Label(gui, image=photoImg)
  ColaLabel.grid(column=6, row=0)
  Colala = ttk.Label(gui, text='30')
  Colala.grid(column=5, row=0)
  </code></pre>
  
  <p>And GUI looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/p2Jcm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p2Jcm.png" alt="enter image description here"></a></p>
  
  <p>I tried to make the function this way:</p>
  
  <pre><code>def createGUIProduct(path: str):
      img = Image.open(path)
      img = img.resize((40, 40), Image.ANTIALIAS)
      return ImageTk.PhotoImage(img)
  </code></pre>
  
  <p>And calling it by this way:</p>
  
  <pre><code>ColaLabel = ttk.Label(gui, image=createGUIProduct("images/cola.jpg"))
  ColaLabel.grid(column=6, row=0)
  Colala = ttk.Label(gui, text='30')
  Colala.grid(column=5, row=0)
  </code></pre>
  
  <p>And the result is:</p>
  
  <p><a href="https://i.stack.imgur.com/ZFeRA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZFeRA.png" alt="enter image description here"></a></p>
  
  <p>EDIT:</p>
  
  <p>After modifing function: </p>
  
  <pre><code>def createGUIProduct(path: str):
      global photoImage
      img = Image.open(path)
      img = img.resize((40, 40), Image.ANTIALIAS)
      photoImage = ImageTk.PhotoImage(img)
      return photoImage
  </code></pre>
  
  <p>And calling two products by the same way:</p>
  
  <pre><code>ColaLabel = ttk.Label(gui, image=createGUIProduct("images/cola.jpg"))
  ColaLabel.grid(column=6, row=0)
  Colala = ttk.Label(gui, text='30')
  Colala.grid(column=5, row=0)
  
  
  WodaLabel = ttk.Label(gui, image=createGUIProduct("images/woda.jpg"))
  WodaLabel.grid(column=8, row=0)
  Wodala = ttk.Label(gui, text='31')
  Wodala.grid(column=7, row=0)
  </code></pre>
  
  <p>Only one show up:</p>
  
  <p><a href="https://i.stack.imgur.com/Z3tbZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z3tbZ.png" alt="enter image description here"></a></p>