Remote Panel infinite loop

Trying to get some input from the Remote Panel.

I can’t get this to work. It gets stuck in a loop for some reason after I click the button in the Remote Panel.
There’s no problem if I click the button on the GH canvas… but that’s what I’m trying to avoid. I want to set up everything in the remote panel.

import Grasshopper as gh
import rhinoscriptsyntax as rs
def getUserInput(currentValue):
    return rs.EditBox(currentValue,"","Edit Panel Content")

def updatePanel(id):
    for obj in ghenv.Component.OnPingDocument().Objects:
        if obj.InstanceGuid == id:
            if type(obj) is gh.Kernel.Special.GH_Panel:
                temp = getUserInput(obj.UserText)
                if temp:
                    obj.UserText = temp
                    obj.ExpireSolution(True)
    return


id = ghenv.Component.Params.Input[1].Sources[0].InstanceGuid


if run:
    updatePanel(id)

There is a bit chicken and egg issue here.
Remember when you expire the panel, that’s gonna trigger this python component to update itself, hence the loop.
I’m surprised you didn’t get the “cannot expire object during a solution” error.

This should do it:
upstreamupdate.gh (3.6 KB)

1 Like

super cool, thanks Will!