developing python applications for freeswitch I'm currently struggling with the python cache feature. In my dailplan I'm calling a python script using mod_python3. That script imports further modules which I want to modify and test with the next call. Currently my only option is to restart freeswitch what gives me a moment to take the next coffee break. When I've got it right the problem is that mod_python starts the python application for the entire running time of the freeswitch application. So once the modules for an application are loaded with the first call they stays active.
Do you have any advice or good solution how I can deal with the cache as a developer.
One solution would be to reload this particular python mod on fs_cli, but it seems to be unloadable for robustness reason when in production use:
freeswitch@freeswitch> reload mod_python3
+OK Reloading XML
-ERR unloading module [Module is not unloadable]
-ERR loading module [Module already loaded]
The other option I've tried is to reload the modules using the importlib and the reload function in my start script at the beginning. But this does not help and I have still to restart freeswitch.
import demoPy.module as module. #demoPy is the project containing a module named module :)
import importlib
importlib.reload(module)
Last option I've tried is to clean up the cache files from the local storage by using pyclean in my project folder. That cleaned up all the cache files from the storage but takes no effect on the already loaded modules in mod_python.