title: Python Kivy/kivyMD load second screen method in authentication page
body: <p>I want to know the method of loading the second screen when authentication is passed.
  I can call the second screen from the .kv file vi on_press or other methods. But I need to call from python code to check the authentication.
  Can anyone help with my code?
  Here is my code:</p>
  <p>app.py</p>
  <pre><code>from kivy.lang import Builder
  from kivymd.app import MDApp
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.screenmanager import Screen, ScreenManager
  from kivy.properties import ObjectProperty
  
  
  class my_layout(FloatLayout):
      screen_mngr = ObjectProperty(None)
  
  
  class myapp(MDApp):
  
      def build(self):
          self.theme_cls.theme_style = &quot;Light&quot;
          self.theme_cls.primary_palette = &quot;BlueGray&quot;
          return Builder.load_file(&quot;app.kv&quot;)
  
      def logger(self):
          if self.root.ids.user.text == 'admin' and self.root.ids.password.text=='admin':
              self.root.ids.welcome_label.text = f'Sup {self.root.ids.user.text}!'
              screen = Screen(name='screen2')
          else:
              self.root.ids.welcome_label.text = 'Wrong credentials'
  
  if __name__ == &quot;__main__&quot;:
      myapp().run()
  </code></pre>
  <p>And here is my design kv file.</p>
  <p>app.kv file:</p>
  <pre><code>my_layout:
      
      screen_mngr: screen_mngr
  
      ScreenManager:
          id: screen_mngr
          home: home
  
          Screen:
              id: home
              name: 'home'
  
              MDCard:
                  size_hint: None, None
                  size: 450, 600
                  pos_hint: {&quot;center_x&quot;: 0.5, &quot;center_y&quot;: 0.5}
                  elevation: 10
                  padding: 25
                  spacing: 25
                  orientation: 'vertical'
  
                  MDLabel:
                      id: welcome_label
                      text: &quot;WELCOME&quot;
                      font_size: 40
                      halign: 'center'
                      size_hint_y: None
                      height: self.texture_size[1]
                      padding_y: 15
  
  
                  MDTextField:
                      id: user
                      hint_text: &quot;username&quot;
                      icon_right: &quot;account&quot;
                      size_hint_x: None
                      width: 200
                      font_size: 18
                      pos_hint: {&quot;center_x&quot;: 0.5}
  
                  MDTextField:
                      id: password
                      hint_text: &quot;password&quot;
                      icon_right: &quot;eye-off&quot;
                      size_hint_x: None
                      width: 200
                      font_size: 18
                      pos_hint: {&quot;center_x&quot;: 0.5}
  
                  MDRoundFlatButton:
                      text: &quot;LOG IN&quot;
                      font_size: 12
                      pos_hint: {&quot;center_x&quot;: 0.5}
                      on_press: screen2
  
  
          Screen:
              id: screen2
              name: 'screen2'
  
              MDRoundFlatButton:
                  text: &quot;This is Second Screen\nGo to Screen1&quot;
                  size_hint: 0.2,0.1
                  pos_hint: {&quot;center_x&quot;:0.5,&quot;y&quot;:0.5}
                  on_press: screen_mngr.current = &quot;home&quot;
  </code></pre>