The only way to achieve this in TVH 3.0 (or older) is to run the grabber externally and capture the output to file and then use tv_grab_file from within TVH.
For newer builds (from git) you can setup a unix domain socket which you can then have you're script write data to. This allows users to setup more complex XMLTV setups, such as multiple scripts, command line flags, advanced scheduling via cron etc..
Adam