random

So i have been trying to get an object to randomly move from the top of the the screen to a random point at the bottom of the screen can anyone have a look at this code because i am not really sure how to do this or if i am writing the code remotely in the right way

import direct.directbase.DirectStart
from pandac.PandaModules import NodePath
from direct.showbase.DirectObject import DirectObject
from direct.task import Task
import direct.directbase.DirectStart
from panda3d.core import Point3
from direct.interval.IntervalGlobal import Sequence
import sys
from random import choice, random


class world(DirectObject):

    def __init__ (self):
           
       
       base.setBackgroundColor(0, 0, 0)    #Set the background to black
       base.disableMouse()
       camera.setPos ( 0, 0, 45 )          #Set the camera position (X, Y, Z)
       camera.setHpr ( 0, -90, 0 )         #Set the camera orientation
       
   
      #loading in the object and giving it a texture#
       self.Sun = loader.loadModel("models/planet_sphere")
       self.Sun.reparentTo(render)
   
      #setting up a random positions from the top of the screen and moving an object 
      #to some random position at the botto=om of the screeen
      
    def topPos (self): 
       for i in range(20):
       
         self.Sun[i].setPos.random.choice(-10, 15, 0) , (10, 15, 0)
         
    def bottomPos (self):
       for i in range(20):
       
          self.Sun[i].setPos.random.choice(-10, -15, 0) , (10, -15, 0)
                                       
       
          SunPosInterval1 = self.Sun.posInterval(5, 
                                               endpoint = self.bottomPos,
                                               startPos = self.topPos,
                                               blendType = "easeIn")
                                   
                                                  
          self.movingSun = Sequence(SunPosInterval1, 
                                    name = "movingSun")
          self.movingSun.loop()
       
                                       
                                                            
      
        
w = world()                         
run()

don’t take me wrong, but I suggest you read a few general Python tutorials first. Especially the chapters about lists and methods. Your question has nothing to do with Panda3D.

ok thankyou for your suggestion