Vision Based pick-and-place with vacuum

Hello guys,
i`m a absolutely noob in coding and hope anyone here can please help me.
I saw this project
Vision Based pick and place
and i find it amazing.

I hope anyone can help me code a similiar project.

The openmv should detect the position of 4 different boxes
Every box have the same parts inside but different parts to the other box.
Uarm should pick from every box one part and place it into a fifth empty box

The script “” works great for me.

My problems are:

  1. How i can make it, that uarm recognizes that box 1 is first to start to pick and go back to box 1-4 into a loop after the part from box 4 is picked and placed to the fifth box
  2. How i can implement the “” script that uarm will pick the first part inside every box which it have recognize with the “”

I hope here is a pro coder which can help me to code this project

Thanks and Regards