title: How to call a function in the backend without a click event in kivy
body: <p>I have a screen which does not have any button but a label that shows my system is active. Then I want to call the main of another python program (separate from kivy) whenever I arrive on that screen. I have tried on_enter() but failed.</p>
  
  <p>I don't know how to really use on_enter() if one can guide me with working examples then that will be just fine for me.</p>
  
  <p>I have merged all the screens through the main so the code will be a bit longer as I want to give you a clear picture of what I have achieved so far.</p>
  
  <p>main.py</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.boxlayout import BoxLayout
  
  from Login.login import BackendWindow, MyScreenManager
  from Register.register import RegisterWindow
  from Activated_System.active_screen import ActiveWindow
  from Result.result import ResultWindow
  
  class MainWindow(BoxLayout):
  
  
      login_widget = BackendWindow()
      register_widget = RegisterWindow()
      active_widget = ActiveWindow()
      result_widget = ResultWindow()
  
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
  
          self.ids.scrn_login.add_widget(self.login_widget)
          self.ids.scrn_reg.add_widget(self.register_widget)
          self.ids.scrn_active.add_widget(self.active_widget)
          self.ids.scrn_result.add_widget(self.result_widget)
  
  
  class MainApp(App):
      def build(Self):
          return MainWindow()
  
  if __name__=='__main__':
      MainApp().run()
  </code></pre>
  
  <p>main.kv</p>
  
  <pre><code>&lt;MainWindow&gt;:
      id: main_win
  
      ScreenManager:
          id: scrn_mngr_main
  
          Screen:
              id: scrn_login
              name: 'scrn_login'
  
          Screen:
              id: scrn_reg
              name: 'scrn_reg'
  
  
          Screen:
              id: scrn_active
              name: 'scrn_active'
  
  
          Screen:
              id: scrn_result
              name: 'scrn_result'
  </code></pre>
  
  <p>Above is the main code from where I am controlling the transfer of all the screen.</p>
  
  <p>Below is the screen where I want to call the main of a separate python program and run it</p>
  
  <p>active_screen.py</p>
  
  <pre><code>from kivy.app import App
  
  from kivy.lang import Builder
  
  Builder.load_file('Activated_System/active.kv')
  
  class ActiveWindow(BoxLayout):
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
  
  
  
  class ActiveApp(App):
      def build(self):
          return ActiveWindow()
  
  
  if __name__ == "__main__":
      sa = ActiveApp()
      sa.run()
  </code></pre>
  
  <p>Apart from this, I am transferring control to another screen like this in the rest of the screens through a button click:</p>
  
  <pre><code>self.parent.parent.current = 'scrn_id'
  </code></pre>
  
  <p>Please let me know how can I achieve this I have tried some ways like calling the main of separate python program in the constructor but that calls the program even before I reach the active_screen page as I have made the objects in the main.py</p>
  
  <p>I am still learning kivy so a detailed answer will be more useful.</p>