Continuous Alchemy on Python

Hello I started this code combat 2 week before, and I am stuck in Continuous Alchemy.
My code is below.

while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()

# If there is no enemy, continue out of the loop.
if not enemy:
    continue
    
# If there is an enemy, but no item, ask for a potion and continue out of the loop.
if not item:
    hero.say("Give me a drink!")
    continue

# Use an if-statement to check the item's type. If the type is "poison", continue out of the loop.
if item.type == "poison":
    continue
        # If it is not, the potion must be a bottle of water, so walk to it # and return to the starting position!
elif item.type != "poison":
    hero.moveXY(44, 35)
    hero.moveXY(34, 47)

can someone show me the correct way.
thanks

To move to an item use this:

hero.moveXY(item.pos.x, item.pos.y)

thanks
I finally pass this one.