I am experimenting with some userconfig values for saving certain preferences. I one hook that writes a value to a custom userconfig value, and then another hook that reads that value and acts accordingly. However, what i have noticed is that when hook 1 makes the change, hook 2 doesn’t seem to register it. For example, I have a userconfig boolean set to True and hook 1 sets that value to False:
Only way I can get it to register the change is by reloading pyRevit, but that’s not an option. Do changes to the config file only get registered on reload?
Hi @DennisGoff,
I see that you wrote usercongfig, but do you mean that you’re using the pyrevit.userconfig.user_config global variable?
If so, I believe this is the problem, that global variabel doesn’t get updated. And that’s why I usually avoid global variables and code outside functions
We should move all the following code to an init_user_config function so that you can call it to create your own user config variable or rewrite the global one.
Are you up to the task and willing to make this change? (Note that these my assumptions just by looking at the code, so it might not work, but it’s worth a try)
I don’t think I would know where to begin making changes to the actual pyRevit code. But for a little more context, I’m trying to implement the autosave feature from this PR on github:
It works fine, but what I noticed is that if you turn it off/on, the change doesn’t register without a reload of pyRevit. I suppose you could just write to some local file rather than editing the pyRevit_config.ini file