title: How can I do movements with widgets in ScreenManager when I reach the screen that holds the objects?
body: <p>I just want to move the ball or any other object when I move to that level screen that is MainWindow...
  The next program below this one does something relative that I want but that's not having different screens...
  Here is the code... </p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.label import Label
  from kivy.uix.screenmanager import ScreenManager, Screen
  from kivy.properties import ObjectProperty, NumericProperty, ReferenceListProperty
  from kivy.uix.widget import Widget
  from kivy.vector import Vector
  from kivy.graphics import Rotate, Rectangle, Ellipse, Color
  from kivy.uix.gridlayout import GridLayout
  from kivy.clock import Clock
  from kivy.lang import Builder
  
  class LoginWindow(Screen):
      def loginbtn(self):
          sm.current = "stage"
  
  
  class StageWindow(Screen):
      def nextpage(self):
          sm.current = "main"
          game = MainWindow()
          game.serve_ball()
          Clock.schedule_interval(game.update, 1.0 / 60.0)
          return game
  
  class MainWindow(Screen):
      ball = ObjectProperty(None)
      object = ObjectProperty(None)
  
      def serve_ball(self, vel=(4, 0)):
          self.ball.center = 40, 310
          self.ball.velocity = vel
          print('served')
  
      def update(self, dt):
          self.ball.move()
          self.object.deflect_ball(self.ball)
          if (self.ball.y &lt; self.y):
              self.ball.velocity_y *= -1
              self.ball.velocity_y = 0
          if (self.ball.top &gt; self.top):
              print('Done')
  
      def start(self):
          self.serve_ball()
          Clock.schedule_interval(self.update, 1.0 / 60.0)
  
  class Object(Widget):
      def __init__(self, *args, **kwargs):
          Widget.__init__(self, *args, **kwargs)
          self.rect_pos_x = 500
          self.rect_pos_y = 300
          self.rect_pos = self.rect_pos_x, self.rect_pos_y
          self.rect_width = 200
          self.rect_height = 50
          self.rect_size = self.rect_width, self.rect_height
          self.rotate_origin_x = self.rect_pos_x + self.rect_width / 2
          self.rotate_origin_y = self.rect_pos_y + self.rect_height / 2
          self.rotate_origin = self.rotate_origin_x, self.rotate_origin_y
          self.angle = 135
          with self.canvas:
              Rotate(origin=self.rotate_origin, angle=self.angle)
              Color(rgb=(0, 255, 100))
              Rectangle(pos=self.rect_pos, size=self.rect_size)
  
  
      def rotate(self):
          self.canvas.clear()
          with self.canvas:
              Rotate(origin=self.rotate_origin, angle=self.angle)
              Color(rgb=(0, 255, 100))
              Rectangle(pos=self.rect_pos, size=self.rect_size)
          self.angle += 90
          print(self.angle)
  
      def deflect_ball(self, ball):
          if self.collide_widget(ball):
              vx, vy = ball.velocity
              if self.angle == 135:
                  ball.velocity = Vector(-vx, vy).rotate(90)
              else:
                  ball.velocity = Vector(-vx, vy).rotate(270)
              print('collided')
  
      def on_touch_up(self, touch):
          if self.collide_point(*touch.pos):
              self.rotate()
              print('hi')
  
  class PongBall(Widget):
      velocity_x = NumericProperty(0)
      velocity_y = NumericProperty(0)
      velocity = ReferenceListProperty(velocity_x, velocity_y)
  
      def move(self):
          self.pos = Vector(*self.velocity) + self.pos
  
      def on_touch_up(self, touch):
          if self.collide_point(*touch.pos):
              print('clicked')
  
  class WindowManager(ScreenManager):
      pass
  
  
  kv = Builder.load_file("my.kv")
  sm = WindowManager()
  
  
  screens = [LoginWindow(name="login"), StageWindow(name="stage"), MainWindow(name="main")]
  for screen in screens:
      sm.add_widget(screen)
  
  sm.current = "login"
  
  class GameApp(App):
      def build(self):
          return sm
  
  if __name__ == "__main__":
      GameApp().run()
  </code></pre>
  
  <p>Kivy file for one above is...</p>
  
  <pre><code>WindowManager:
      StageWindow:
      LoginWindow:
      MainWindow:
  
  &lt;StageWindow&gt;:
      name: "stage"
      FloatLayout:
          Label:
              pos_hint:{"x": 0.04, "y":0.3}
              size_hint:1.0, 1.0
              text: "Stage&gt;&gt;"
  
          Button:
              pos_hint:{"x":0,"y":0.05}
              size_hint: 0.2, 0.2
              text:"1"
              on_release:
                  root.manager.transition.direction = "up"
                  root.nextpage()
          Button:
              pos_hint:{"x":0.2,"y":0.05}
              size_hint: 0.2, 0.2
              text:"2"
              on_release:
                  root.manager.transition.direction = "up"
                  root.nextpage()
          Button:
              pos_hint:{"x":0.4,"y":0.05}
              size_hint: 0.2, 0.2
              text:"3"
              on_release:
                  root.manager.transition.direction = "up"
                  root.nextpage()
          Button:
              pos_hint:{"x":0.6,"y":0.05}
              size_hint: 0.2, 0.2
              text:"4"
              on_release:
              root.manager.transition.direction = "up"
                  root.nextpage()
          Button:
              pos_hint:{"x":0.8,"y":0.05}
              size_hint: 0.2, 0.2
              text:"5"
              on_release:
                  root.manager.direction = "down"
                  root.nextpage()
  
  
  &lt;LoginWindow&gt;:
      name: "login"
  
  
      FloatLayout:
  
  
          Button:
              pos_hint:{"x":0.2,"y":0.05}
              size_hint: 0.6, 0.2
              font_size: (root.width**2 + root.height**2) / 13**4
              text: "Play"
              on_release:
                  root.manager.transition.direction = "left"
                  root.loginbtn()
  
  
  &lt;MainWindow&gt;:
  
      ball: pong_ball
      object: Object
  
  
      PongBall:
          id: pong_ball
          size: 50, 50
          canvas:
              Color:
                  rgba: 0,0,1,1
              Ellipse:
                  pos: self.pos
                  size: self.size
          center: self.center
  
  
      Object:
          id: Object
          center: self.rotate_origin
  </code></pre>
  
  <p>It is that one that shows something I want to do when I reach MainWindow...</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.widget import Widget
  from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty
  from kivy.vector import Vector
  from kivy.clock import Clock
  from random import randint
  from kivy.lang import Builder
  from kivy.graphics import Rotate, Color, Rectangle, Ellipse
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.screenmanager import ScreenManager, Screen
  
  Builder.load_string('''
  
  &lt;PongGame&gt;:
      name:"game"
  
      ball: pong_ball
      object: Object
  
  
      PongBall:
          id: pong_ball
          size: 50, 50 
          canvas:
              Color:
                  rgba: 0,0,1,1
              Ellipse:
                  pos: self.pos
                  size: self.size 
          center: self.center
  
  
      Object:
          id: Object
          center: self.rotate_origin
  
  
  ''')
  
  class Object(Widget):
      def __init__(self, *args, **kwargs):
          Widget.__init__(self, *args, **kwargs)
          self.rect_pos_x = 500
          self.rect_pos_y = 300
          self.rect_pos = self.rect_pos_x, self.rect_pos_y
          self.rect_width = 200
          self.rect_height = 50
          self.rect_size = self.rect_width, self.rect_height
          self.rotate_origin_x = self.rect_pos_x + self.rect_width / 2
          self.rotate_origin_y = self.rect_pos_y + self.rect_height / 2
          self.rotate_origin = self.rotate_origin_x, self.rotate_origin_y
          self.angle = 135
          with self.canvas:
              Rotate(origin=self.rotate_origin, angle=self.angle)
              Color(rgb=(0,197,68))
              Rectangle(pos=self.rect_pos, size=self.rect_size)
  
  
      def rotate(self):
          self.canvas.clear()
          with self.canvas:
              Rotate(origin=self.rotate_origin, angle=self.angle)
              Color(rgb=(0, 255, 100))
              Rectangle(pos=self.rect_pos, size=self.rect_size)
          self.angle += 90
  
      def deflect_ball(self, ball):
          if self.collide_widget(ball):
              vx, vy = ball.velocity
              if self.angle == 135 :
                  ball.velocity = Vector(-vx, vy).rotate(90)
              else:
                  ball.velocity = Vector(-vx, vy).rotate(270)
              print('collided')
  
      def on_touch_up(self, touch):
          if self.collide_point(*touch.pos):`enter code here`
              self.rotate()
  
  class PongBall(Widget):
      velocity_x = NumericProperty(0)
      velocity_y = NumericProperty(0)
      velocity = ReferenceListProperty(velocity_x, velocity_y)
  
  
      def move(self):
          self.pos = Vector(*self.velocity) + self.pos
  
  
  
  class PongGame(Widget):
      ball = ObjectProperty(None)
  
      object = ObjectProperty(None)
  
      def serve_ball(self, vel=(4, 0)):
          self.ball.center = 40, 310
          self.ball.velocity = vel
          print('hi')
  
      def update(self, dt):
          self.ball.move()
          self.object.deflect_ball(self.ball)
  
          if (self.ball.y &lt; self.y):
              self.ball.velocity_y *=-1
              self.ball.velocity_y = 0
          if (self.ball.top &gt; self.top):
              print('Done')
  
  
      def start(self):
          self.serve_ball()
          Clock.schedule_interval(self.update, 1.0 / 60.0)
  
  
  class PongApp(App):
      def build(self):
          game = PongGame()
          game.serve_ball()
          Clock.schedule_interval(game.update, 1.0/60.0)
          return game
  
  
  if __name__ == '__main__':
      PongApp().run()
  </code></pre>
  
  <p>I know that there are so many problems here that I have to sort-out but firstly please solve this one...</p>
  
  <p>Thanks</p>