For what it’s worth to others who encounter same problems as me running python functions:
The ai object seems passed as a dictionary, and the way to interact with it is using keys like 'config' and 'vars', rather than the .getConfig() method mentioned in the documentation.
I.e. instead of the methods mentioned in the quick help, which I had trouble with, I successfully used this kind of syntax:
variable_name = ai["config"]["variableName"]
value = ai["config"]["integerValue"]
ai["vars"][variable_name] = int_value
FYI - the ai object:
Type of ai object: <class ‘dict’>
Attributes of ai: [‘class’, ‘class_getitem’, ‘contains’, ‘delattr’, ‘delitem’, ‘dir’, ‘doc’, ‘eq’, ‘format’, ‘ge’, ‘getattribute’, ‘getitem’, ‘getstate’, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘ior’, ‘iter’, ‘le’, ‘len’, ‘lt’, ‘ne’, ‘new’, ‘or’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘reversed’, ‘ror’, ‘setattr’, ‘setitem’, ‘sizeof’, ‘str’, ‘subclasshook’, ‘clear’, ‘copy’, ‘fromkeys’, ‘get’, ‘items’, ‘keys’, ‘pop’, ‘popitem’, ‘setdefault’, ‘update’, ‘values’]