How to run a python script from a html widget

I want to use the pi player to control an external device. Is it possible to stop for a short time the player just for load the script ? And next to run this script from an Html Widget ? Tks.