Midi PC Annoyances

So I’m using live loops to send a repeating pattern of notes to a VSTi via Midi. As part of my “song” I need to specify the channel and program (i.e. synth “preset”) for each live loop. The problem is that there is an audible “pause” each time the midi_pc message is sent (even if “changing” to the same program). If I do this within a live loop, the pause can be heard between each cycle of the loop. If I do this once at the beginning (i.e. above the live loops) then this pause can be heard every time I press “Run” (which I obviously need to be able to do in order to improvise and perform live).

I don’t mind either approach, but somehow I need to prevent the midi_pc message from being sent if it’s already on the program I want. Is there a way to “query” the midi channel to find out which program it’s currently set to? Or is there a way to only execute this line of code on the very first cycle of the live loop?