Also here's an interesting session from GS 2022 that you might find helpful to target a method for your use case: https://youtu.be/CQqXkuWkHiY?si=Fiug-X54uFRku_7U
I know this isn't helpful but it knocks one solution OFF the list. I thought you could use Outputs in your method signature but this isn't supported with Python methods:
While passing arguments by reference is a feature of ObjectScript methods, there is no equivalent way to pass arguments by reference to a method written in Python. The ByRef and Output keywords in the signature of an ObjectScript method are conventions used to indicate to the user that the method expects that an argument is to be passed by reference. In fact, ByRef and Output have no actual function and are ignored by the compiler. Adding ByRef or Output to the signature of a method written in Python results in a compiler error.
https://docs.intersystems.com/iris20241/csp/docbook/DocBook.UI.Page.cls?...
From your example, I think you'd want to fire up the Python shell from the COS command line and import the iris package and call your function with the normal multiple return value syntax. If you import the iris package you can then save the output to a global or pass it to another COS function that you need it for.
From the WRC:
I spoke to the developer and he said it's a bug . . . there is an existing project to clean up a bunch of code in this area. I'll ask them when it will be finished and in what version the code will appear.