Where to put the main loop?

ok well first of all im recreating one of my games i made in 2d over into 3d which ads a much more skill-oriented gameplay.

So in 2d (pygame) you would have a loop like:

[code
]while True:
# Limit frame speed to 50 FPS
#
time_passed = clock.tick(frameRate)

 #all code that needs to be updated.

[/code]

so i realize panda operates differently.

do i need a main loop for things such as keyboard input? and where would i put it?

this is my code so far:

import direct.directbase.DirectStart

class ship:
    def __init__(self):
        self.shipName = "pod"

        self.xPos = 0

        self.yPos = 0
        
        self.zPos = 0

        self.position = (self.xPos, self.yPos, self.zPos)

        self.width = 120

        self.height = 120

        self.hull = 100

        self.hullMax = 1000

        self.energy = 1000

        self.energyMax = 1000

        self.engineSpeed = 5
        
        self.turningSpeed = 5

        self.thrustingSpeed = 0

        self.thrustingSpeedMax = 10

        self.primaryWeapon = 1

        self.secondaryWeapon = 0

        self.secondaryWeaponMax = 0

        self.angle = 0

        self.isComp = True;

playerShip = ship()
playerShip.xPos = 0
playerShip.yPos = 0
playerShip.zPos = 0
playerShip.turningSpeed = 90
playerShip.isComp = False


base.disableMouse()

base.camera.setPos(0, playerShip.yPos - 30, 0)        

ship = loader.loadModel("Models/Ships/fighter")
ship.reparentTo(render)
ship.setScale(0.25,0.25,0.25)
ship.setPos(playerShip.position)

run()

run() is basically a loop that does this:

while True:
  taskMgr.step()

… but a little more complicated.

There’s a bit of a discussion on exactly this topic about a page down:
discourse.panda3d.org/viewtopic … 24176b39a8