I’m in M mode and I’m referring to the script resetting the Canon reported shutter time and hence the exposure.
FWIW, "Canon reported shutter time" and what is actually used by the camera are not necessarily the same thing once you've started messing with propcases and overrides.
If you are using M mode (or any mode where the Canon UI allows a user-specified Tv), I'd suggest setting the USER_TV propcase, outside of half press. That should be equivalent to setting the shutter in the Canon UI, although the value displayed in the Canon UI itself may not update immediately. When using USER_TV in these modes, you should not need to change the TV prop, or use set_tv* calls.
Similarly, if you want to read the user specified value from the Canon firmware, you should read USER_TV rather than TV.