When clicking a button how to load another window?

Yeah I suck at this :stuck_out_tongue: Why doesn’t this work?

close panel “main”
load panel “test”
display panel “test”

This works for me, is all is set-up OK in IB:

on clicked theObject
     show window "whatever" -- in front of window "main"
end clicked

Or, if you wish load it as a panel:

on clicked theObject
     set thePanel to (load panel "whatever" from nib "main")
     display panel thePanel -- attached to window "main"
end clicked