title: How do I stop Tkinter window from destroy when the navigation button is clicked the second time?
body: <p>I have a tkinter app with a main window and a secondary window. When I click the navigation button (Next Page) on the main window to move to the next page, it works fine; when I click the &quot;Back&quot; button to move back, it also works fine. The problem is, the next time I click the &quot;Next Page&quot; button on the main page, the window destroys. How do I make it such that I can move back and forth indefinitely without closing the window? Below are the codes for the two navigation buttons:</p>
  <pre><code>#the function to move to move from main to secondary page
  def next_page():
      root.destroy()
      import page2 
  
  #the function to move back from secondary to main page
  def home_page():
      root.destroy()
      import page1
  </code></pre>