Resetting module to update constants.py
Hello,
I am creating a script that should allow me to run multiple experiments in a row without restarting the script. I want to have the option to change values that are saved in constants.py (e.g. tracker type) between these sessions, I think that this is doable by re-loading the entire pygaze module, but I was hoping that there would be a faster way. I saw that this problem was mentioned in https://github.com/esdalmaijer/PyGaze/issues/13 , but it seems that this fix has not been implemented to the latest version.
Is there a better way of changing the values from constants.py between two experiments than re-loading the entire module?
Comments
Could your clarify what you mean by "to change values that are saved in constants.py"? Are you going to do so by manually or programmatically editing the file as your application is running?
I guess you could try to have several sets of constants.py type files, and load them as such:
pygaze.settings.read_module("my_settings.py")I don't actually know if this works, but it's worth a try!
Please do note, though, that changing settings at runtime might not always be wise or even possible. For example, editing the DISPSIZE or DISPTYPE will do absolutely nothing, as the active display will have already been created.
Hello and thank you for the reply
I plan on changing the values in constants.py programmatically. In theory the user should be able to run the experiment in dummy mode first, and then with an actual eyetracker. (or even change screens in between two experiments, which is a very unlikely scenario, but it could be possible)
Thank you for your suggestion, I will experiment to see what works and what doesn't