Nuke python: add launch custom panel in menu.py
I'm creating a custom panel using code like this:
from PySide2 import QtWidgets
import nuke
import nukescripts
class TestPanel(QtWidgets.QWidget):
pass
nuke.TestPanel = TestPanel
_pane = nuke.getPaneFor('Properties.1')
_panel = nukescripts.panels.registerWidgetAsPanel(
'nuke.TestPanel', 'Test Panel', 'TestPanel', create=True)
_panel.addToPane(_pane)
However, I'm trying to get this panel to launch on startup and if I run this in menu.py then nuke.getPaneFor('Properties.1') returns None and nothing happens. Is there a way to make a custom panel appear on nuke startup?