python changes to UI and debugging

Change the python file and save. My experience is that on some computers it works and on some computers the game won't notice I'm not entirely sure what the difference is, but it works on my current computer so I'm not investigating.

One note though. When reloading a python file the game clears all the variables in that file so if you say open an advisor screen and then change it, you might get a lot of errors about using uninitialized variables. It's better to close it, save the file and then open the screen again. Editing the main interface file might be a hassle because of this.
 
anyone knows how can i make changes to the python ui without restarting the game for every single change i do?
Sometimes you need to switch to another ingame screen and come back to the screen you changed to have it refresh.
But for most changes in Python all you need to do is to save the Python file and it will refreshes with your changes instantly.
 
Last edited:
With the BUG mod, I always(?) get a bunch of unhandled Python exceptions upon reloading scripts, and then part of the screen may not get updated properly, Advisors may become inaccessible, will need to exit and restart (screenshot from BUG 4.4 attached; reload caused by a change to CvMainInterface.py). So, as far as I can tell, editing scripts at runtime isn't really possible with BUG-based mods. In AdvCiv, I've gotten things to a point where reloading will often succeed, and, when it doesn't, making another change (to the same script, or maybe a different one), will usually do the trick. But I don't know enough about Python and the BUG design to fix this properly. A bit strange that BUG introduced those issues; as a Python-only mod, you'd think that its creators themselves would've been greatly inconvenienced.
 

Attachments

  • BUG-py-crash.jpg
    BUG-py-crash.jpg
    169.3 KB · Views: 28
Has anyone found a way for reloading python modules with the game running using BUG mod?
My mod is BUG based and a Shift-F5, Shift-F8 usually does the job if you get errors
once errors show up the interface disappears (with AND mod)
 
Top Bottom