title: Executing a top-level from a function on another file
body: <p>Good afternoon, I've been here for a couple of hours puzzled with this wall.</p>
  
  <p>I'm trying to execute a top-level from another file, it works, but I've to click the button twice.</p>
  
  <pre><code># main.py
  print("main.py\n")
  
  from tkinter import * 
  from windowMaker import *
  
  root = Tk()
  
  # Gets window's Width and Height values.
  windowWidth = root.winfo_reqwidth()
  windowHeight = root.winfo_reqheight()
  #print("Width:",windowWidth,"Height:",windowHeight)
  
  # Gets window's halves (Width and Height from the screen and window)
  positionRight = int(root.winfo_screenwidth()/2 - windowWidth/2)
  positionDown = int(root.winfo_screenheight()/2 - windowHeight/2)
  
  # Puts the window in the center of the user's screen.
  root.geometry("+{}+{}".format(positionRight, positionDown))
  
  window = Button(root, text="Create", command=createWindow)
  window.grid(row = 0, column = 0, sticky="we")
  
  window = Button(root, text="Read", command=readWindow)
  window.grid(row = 1, column = 0, sticky="we")
  
  window = Button(root, text="Update", command=updateWindow)
  window.grid(row = 2, column = 0, sticky="we")
  
  window = Button(root, text="Delete", command=deleteWindow)
  window.grid(row = 3, column = 0, sticky="we")
  
  mainloop()
  </code></pre>
  
  <p>Executing the main.py</p>
  
  <blockquote>
    <blockquote>
      <p>main.py</p>
      
      <p>windowMaker.py</p>
    </blockquote>
  </blockquote>
  
  <p><em>clicks the "Create" Button</em></p>
  
  <blockquote>
    <blockquote>
      <p>f: createWindow</p>
      
      <p>main.py</p>
    </blockquote>
  </blockquote>
  
  <p><em>clicks it again</em></p>
  
  <blockquote>
    <blockquote>
      <p>f: createWindow</p>
    </blockquote>
  </blockquote>
  
  <p><em>opens the top-level</em></p>
  
  <pre><code># windowMaker.py
  print("windowMaker.py\n")
  
  from tkinter import * 
  
  
  def createWindow():
      print("f: createWindow")
      from main import root
      window = Toplevel(root)
  
      pass
  
  def readWindow():
      print("f: readWindow")
      from main import root
      window = Toplevel(root)
  
      pass
  
  def updateWindow():
      print("f: updateWindow")
      from main import root
      window = Toplevel(root)
  
      pass
  
  def deleteWindow():
      print("f: deleteeWindow")
      from main import root
      window = Toplevel(root)
  
      pass
  </code></pre>
  
  <p>If I don't import * from tkinter it doesn't work 'cause doesn't recognises anything from tkinter, If I import * from tkinter  inside of the create Functions it will give an error cause it's already imported in the main file.</p>
  
  <p>I just wanted to </p>
  
  <p><em>press the button</em>
  <em>opens the window at once not double tap</em></p>