Hi - though the above solutions worked in the specific case I was stuck with, I’m still struggling with this general area of passing references through panel.bind. Rather than posting more specific cases, I’m trying to understand the principle and going over the documentation and other posts here. I think I have found my sticking point (or one of them!) now…
I think I’m beginning to understand because of another of your answers, @jbednar (Get the Values of a Rangeslider - #4 by jbednar). There you mention that the function part of the pn.bind() wrapper treats a parameter object passed as an argument as an alias for the param value.
To apply this to the solution you provided above:
pn.Row(
outer,
pn.bind(lambda x: x.param, outer.param.instance_of_inner)
)
…the outer.param.instance_of_inner
that is passed into the lambda function is the live parameter object that holds the parameter value (an instance of class Inner). That’s important because if the parameter value is passed instead, that’s just the value at the time the bind() function is called, it won’t be live.
However, inside the function that is the first argument of the bind() call, i.e. in this case the lambda function, the param object that was passed is turned silently into a value. In this case the value of the parameter instance_of_inner is a Parameterized class, the lambda function is able to use .param on it to access the parameters of the instance of class Inner.
If this is right then I am finally beginning to understand this behaviour . It makes PERFECT sense because what needs to be watched is the object and what needs to be put into action by the function is the value. However, I am finding it highly counter-intuitive…I guess I’ll get used to it, but I don’t think this is explicitly addressed in the documentation.