Sync_file to automatically sense changes to a file, then reload it

I have no idea about the feasibility of doing this in Sonic Pi, but TouchDesigner has operators (e.g., the MIDI In and OSC In DATs) that have a “sync to file” setting. When the file changes, the new code in the operators replaces the old code for all future iterations (frames). In other words, you can live code visuals in TD directly from Emacs.

My request is an analogous sync_file so that any change to the specified file from any editor causes that file’s updated code to take effect. It would be kind of like a run_file followed by a reload, but not quite. The advantages are a way to effectively have a larger buffer plus the convenience of your editor of choice.

I don’t know the first thing about how the two apps differ under the hood, just the experience from one UI suggesting a feature for the other.