Skip to main content

Node - #activity#execute_script

  • For Xmind ChatTree, the first line of the node content must be "#activity#execute_script", and then the content of the second line is a (single or multi-line) Python script (in the script, InfoItems can be accessed or assigned based on ctx), such as:
    #activity#execute_script
    ...
    ...ctx['{...}']...
    ...
  • For Python ChatTree, the first parameter of chattree.create_node() must be "#activity#execute_script", the key in the second parameter dict is "function", and the value is the Python function name or lambda expression (the function definition or lambda must have a ctx parameter and can access or assign InfoItems based on ctx), such as:
    def xxxx_func(ctx):
    ...
    ...ctx['{...}']...
    ...
    ...
    xxx_node = chattree.create_node("#activity#execute_script", {"function": xxxx_func})
    xxx_node = chattree.create_node("#activity#execute_script", {"function": lambda ctx : ...ctx["{...}"]...})

  • The function of this node is to execute a Python script or a Python function. In the script or function, the ctx variable can be used to access or assign InfoItems to implement complex business logic.
  • For more information, see "Python Script/Function"
  • The "TMC_book_flights", "hospital_registration" and "911" ChatTree examples in "ChatTree Examples" have this node