I continually run into an issue where I get errors from changes being made to my code by the ArcGIS packaging service for python scripts in ArcGIS Pro toolboxes. Specifically, there are variables called `g_esri_variable_#` that are inserted seemingly at random into the middle of my script, usually overwriting text and breaking everything. Moreover, it isn't even consistent. Re-publishing to a server will sometimes fix it. Or sometimes it doesn't work locally until I publish it, then it does. It seems to be related to characters that might be somehow reserved, like "\" and "{}", but I can't find a consistent pattern.
For clarity, I am currently using ArcGIS Pro 3.3.1, but I have found numerous other accounts online of this issue occurring in prior versions. Seems like somebody really needs to find this bug and fix it.