Image in for loop not showing

I’m trying to draw the image located at filedir on the canvas, wait for an input (haven’t done that part yet so I’m just going to use delay() ) and draw the next image.

I forgot to include the clearing of the canvas each iteration of the for loop but I removed the for loop and drew the image normally and it worked all right. I have a feeling that it has something to do with the for loop.

What the code above (should do) does is it searches folder 0 for 1.png. If it isn’t there it searches folder 1 and so on until it finds. Once it finds it it draws it and waits for an input. After the input it then searches for file 2.png and so on.

Hopefully that helps solve my problem.
Thank you.