Perhaps it’s not really its parent and that’s the reason for it not working.
Right – there isn’t actually a DOM parent / child relationship in play here. Both the sidebar and the modal dialog were launched from server-side scripts, and are independent. They can both communicate with the server, though, so you can use a store-and-forward technique to get the result from your picker to the sidebar.
Basic idea:
- The sidebar will start polling the server for the picker’s result as soon as it requests the picker’s launch.
- The picker’s result will be sent to the server, using
google.script.run
. - The server will store the result temporarily – this could be as simple as a global variable, depending on your situation.
- Once there is a result, the next poll will retrieve it.
Have a look at How to poll a Google Doc from an add-on for the basic idea of a poller.