Reusable Custom Logic
Reusable Custom Logic
Reusable Custom Logic
•Why?
• Writing any complex logic in the editor within IQ Bot is going
to be complicated. There is nothing like having your favorite To do this there are a few simple steps
editor to do the heavy lifting.
Choose where on your server you want to have all your
python files
• You also might want a bunch of logic you have written used
mutiple times e.g. in each form field so after a bit it makes Make a directory e.g."c:\somewhere\mydir"
sense to write a package, import it and then use in the put an empty file called "__init__.py" in the directory.
custom logic. This will make python treat this folder as package folder
Go into control panel
• This has the added benefit that the code in IQ Bot is reduced Find environment variables and the option to edit them
to the bare minimum, which makes it easier to maintain
for the system (not user)
- for example if you have put logic in a bunch of fields for
100 groups, it won't be fun editing and testing it again. Add the environment variable PYTHONPATH and set it to
your directory e.g..c:\somewhere\mydir
Restart IQ Bot services (using
• So we can write our required logic in a separate “.py” and
then import it and use any of the functions i.e. a package. stopanduninstallservices.bat and
installandstartservices.bat just to be sure)