title: How to call a function in Python from another screen class?
body: <pre><code>from kivy.app import App
  from kivy.lang import Builder
  from kivy.uix.screenmanger import ScreenManager, Screen
  
  Builder.load_string("""
  &lt;MenuScreen&gt;:
      BoxLayout:
          FloatLayout:
              Image:
                  id: homebackg
                  pos: 0, 0
                  source: "dark.png"
  &lt;SettingsScreen&gt;:
      BoxLayout:
          FloatLayout:
              Image:
                  id: settingsbackg
                  pos: 0, 0
                  source: "dark.png"
              Button:
                  text: ""
                  color: 1.0, 1.0, 1.0, 0.0
                  on_press:
                      root.buttonclick()
  """)
  
  class MenuScreen(Screen):
      def darkmode(self):
          self.ids.homebackg.source = "dark.png"
      def litemode(self):
          self.ids.homebackg.source = "lite.png"
  
  class SettingsScreen(Screen):
      def darkmode(self):
          self.ids.settingsbackg.source = "dark.png"
      def litemode(self):
          self.ids.settingsbackg.source = "lite.png"
      def buttonclick(self):
          file = open("stat.txt", "r")
          themestat = file.read()
          file.close()
          if themestat == "lite":
              SettingsScreen.darkmode(self)
              MenuScreen.darkmode(self)
              file = open("stat.txt", "w")
              file.write("dark")
              file.close()
          elif themestat == "dark":
              SettingsScreen.litemode(self)
              MenuScreen.litemode(self)
              file = open("stat.txt", "w")
              file.write("lite")
              file.close()
  
  sm = ScreenManager()
  sm.add_widget(MenuScreen(name='menu'))
  sm.add_widget(SettingsScreen(name='settings'))
  
  class MyApp(App):
      def build(self):
          return sm
  
  if __name__ == '__main__':
      MyApp().run()
  </code></pre>
  
  <p>Assume I have done the screen transitions properly not adding to make code less bulky, I have issue with changing background of menuscreen from the settingsscreen. It is for darkmode you see, thanks in advance.
  Self is not defined when executing MenuScreen.darkmode(self) from SettingsScreen.</p>