Use specific item code

Hello friends,
I am ıgnorant about phyton code.How to use a specific item ?
Actually i collect goods box, but phbot does not return to the city even if when conditions are met.Phbot is waiting for the command to finish.If not conditions provided it restarts.My command is long and it gets very inefficient.That’s why I want to make it efficient with more than one command.I want it to change contraction when my command is done.I couldn’t find anything in the circumstances that I could set for this.That’s why I decided to go over the item count.I want to use specific item and change the area of ​​contraction.But not using a specific item on the phbot.This requires phyton code.So I wanted to ask if you would be interested in helping me.