You are forgetting about something.
You can not assume that parent has a panel property or a name as it can be called by anyone from outside LAM. I think votan's version of the code is the preferable way to do it.
See #5 in
Differences between v1.0 and v2.0.