title: Why am I getting a (NameError: name 'self' is not defined ) here using Kivy for Python?
body: <p>I'm making a game and I'm working on the screen switching. I want the screen to switch when I press the "play" button but I get a NameError instead. Here's the code:</p>
  
  <pre><code>class menu_screen(Screen):
      def __init__(self, **kwargs):
          super (menu_screen,self).__init__(**kwargs)
  
          menu_layout = FloatLayout
          logo_label = Label(text = "GAME", size_hint=(.6, .2),pos_hint={'x':.2, 'y':.65})
          play_button = Button(text = "Play", size_hint=(.6, .1),pos_hint={'x':.2, 'y':.5})
          play_button.bind(on_release = self.mainscreen_change)
          about_button = Button(text = "About", size_hint=(.6, .1),pos_hint={'x':.2, 'y':.35})
          settings_button = Button(text = "Settings", size_hint=(.6, .1),pos_hint={'x':.2, 'y':.2})
          dev_label = Label(text = "Developer: FRG100", size_hint=(.1, .15),pos_hint={'x':.45, 'y':.9})
  
          menu_layout.add_widget(logo_label)
          menu_layout.add_widget(dev_label)
          menu_layout.add_widget(play_button)
          menu_layout.add_widget(about_button)
          menu_layout.add_widget(settings_button)
          self.add_widget(menu_layout)
  
      def mainscreen_change(self, *args):
          my_screenmanager.current = 'mainscreen'
  </code></pre>
  
  <p>I get a  NameError: name 'self' is not defined for this line:</p>
  
  <pre><code> play_button.bind(on_release = self.mainscreen_change)
  </code></pre>
  
  <p>Thank you for your help!</p>