My Python application is built in such a way that some functions are available as plugins. The plugin architecture is currently very simple: I have a folder / plugin package that contains some python modules. I download the corresponding plugin as follows:
plugin_name = blablabla try: module = __import__(plugin_name, fromlist='do_something') except ImportError: #some error handling ...
and then do:
try: loans = module.do_something(id_t, pin_t) except xxx: # error handling
I will compile the application into a Windows binary using py2exe. This works great, except for the fact that all plugins (and should be) are included in the binary. This is not very practical, because for each new plugin I have to recompile and release a new version of my application. It would be better if a new plug-in (i.e. a python file) could be copied to some folder of the application plug-in and that the Python code in the file code would be interpreted on the fly by my application.
What is the best way to do this?
(although I read every line of the selected plugin file and applied the exec statement to it. be the best ways ...)
python plugins dynamic
Rabarberski
source share