Selected track brings vst to top

I had a macro that attempted to close all open plugs and open all plugs by iterating through the plug list on the selected channel. It was a kuldge and only worked on occasion. I gave up. But, that doesn’t mean it can’t be done.