Probably you can simply launch your process using custom environment. We do this when we launch Elastix. Example:
Note that in case of Elastix, we added more directories to the path/LD path. In your case you probably want to either add your external program’s paths to the beginning of relevant environment variables; or remove all Slicer-specific paths from environment variables.