title: How to access objects in other classes
body: <p>I need to access an object <code>buttonReturn</code> from another class <code>Return</code> so I can call a method on it.</p>
  
  <p>I want to hide <code>buttonReturn</code> on the first page by placing it out of view (<code>x=-100</code>), and then use the next page button to place the return button in view.</p>
  
  <p>I tried using <code>Return.buttonReturn.place(x=0, y=0)</code> but it gave me <code>AttributeError: type object 'Return' has no attribute 'buttonReturn'</code></p>
  
  <p>Below is the program as much as I could reduce it</p>
  
  <pre><code>import tkinter as tk
  PreviousPage = None
  
  
  class Controller(tk.Tk):
      def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, **kwargs)
  
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
  
          self.frames = {}
  
          for F in (FirstPage, SecondPage, Return):
              frame = F(container, self)
              self.frames[F] = frame
              frame.grid(row=0, column=0, sticky="nsew")
  
          self.geometry("200x100")
          self.show_frame(FirstPage)
  
      def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()
  
  
  class Return(tk.Frame):
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
  
          buttonReturn = tk.Button(text="return", command=lambda: controller.show_frame(PreviousPage))
          buttonReturn.place(x=-100, y=0)
  
  
  class FirstPage(tk.Frame):
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
  
          label = tk.Label(self, text="first page")
          label.place(x=0, y=50)
  
          buttonA = tk.Button(self, text="next page", command=lambda: nextPage())
          buttonA.place(x=70, y=0)
  
          def nextPage():
              global PreviousPage
              PreviousPage = FirstPage
              Return.buttonReturn.place(x=0, y=0) #problematic code
              controller.show_frame(SecondPage)
  
  
  class SecondPage(tk.Frame):
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
  
          label = tk.Label(self, text="second page")
          label.place(x=0, y=50)
  
  
  app = Controller()
  app.mainloop()
  </code></pre>