I'm not sure why my program doesn't enter the for loop at all, the code is below:
### Retrieve and edit polygons
def buttonEdit():
for line in myFile:
ptList = line.strip('[]').split(',')
for pt in range(1, len(ptList)):
t.pendown()
t.goto(ptList[pt][0], ptList[pt][1])
### Store polygons in a file
while True:
try:
myFile = open("polygon_data.txt", 'a+')
break
except OSError:
print("File does not exist, please try again!")