Setting multiple KM variables from a Python script?

I have a KM macro that calls a python script and I want that python script to return multiple values for use in the remainder of the KM macro. Is it possible for python to set KM variables?

Thanks, guys.

Gordon

There are two options.

You can set variables from python using AppleScript to control the Keyboard Maestro Engine (see the Scripting section of the documentation).

Alternatively, return them all joined together with some separation character or string that will never appear in the variables. It could be comma, tab, I often use bullet, or if your text can be arbitrary, then use a string like “=KMSEP=” that will be safe enough. Then in Keyboard Maestro, Use the Search Variable action to split them apart.