How to create sidebar?

So script it in the main widget, main widget has access to the panel.

image