Stop the caravan (trade) via python code

I want to stop the proccess of trade with a condition.

This two button does the job but i want to do that via Plugin.


i’ll try and report back thank you. Btw why stop_trade() function can not be found on the website (phBot API - phBot Plugins) ?

it’s working thank you. How can i check if the character is near to a location (x,y) ? i know how to get current location tho, is there any function for this or do i need to code it ?

any code for sell , buy 5 stars functions ?