I don't know if this is technically possible, but I think its a great idea. There are many apps in the App Store that implement a concept of inter-app-communication called x-callback-url. This allows some really advanced automation.
The basic idea is that app1 launches app2 with a url scheme that follows the x-callback-url specification. This means that, in addition to the parameters, it twice adds its own url scheme, one time for success callback and once for error.
This would need to be implemented by Pythonista, as the UIApplication -openURL: options: method in the AppDelegate gets called. However, Pythonista could parse any parameters passed into a dictionary and return it from the webbrowser.openURL method.
Example:
- Launch Drafts with an url scheme and get the contents of a specific note
drafts4://x-callback-url/get?uuid=UUID-TO-VALID-DRAFT&x-success=YOUR_APP_URL_SCHEME://success
Drafts will fetch the contents of the note and call the x-success url you provided, with a text parameter containing the contents of that note