My first script

Hello,
This is my first script, but I want that this script restart when its ends.
I tried with while True:,return and continue but with those functions I get errors.
Does somebody knows which function I can use for to restart this script.

Thanks

`from gopigo import *
import time

set_right_speed(150)
set_left_speed(105)

enable_servo()
mindist = 80
servo(90)
fwd()
print (“forward1x”)
#time.sleep(5)
#stop()

if mindist > us_dist(15):
bwd()
print (“backward1x”,us_dist(15))
time.sleep(2)
left_rot()
print(“left rot”,us_dist(15))
time.sleep(3)
stop()

if mindist < us_dist(15):
fwd()
print(“forward2x”,us_dist(15))
time.sleep(2)
stop()

for x in range(3):

if mindist &gt; us_dist(15):
     bwd()
     print("backward2x",us_dist(15))

What errors are you getting when you run this script? You wrote “I get errors”; which errors and which line numbers?

I indented the rules under while True: and now the script is working.
But now the weels only go’s forward and it prints continue “print forward1x.”

Thanks

I think you might have to share a better formated version of your code for us to help. If it’s not going backward, do you know if your backward code is getting called?