ARTICLE AD BOX
menu.py is executed before Nuke’s UI and panes are fully created, which is why nuke.getPaneFor('Properties.1') returns None at startup. At that point, the Properties pane does not exist yet, so the panel cannot be attached. This is expected behavior and not an error in your code.
You need to delay panel creation until after Nuke’s UI has finished loading.
The standard solution is to use nuke.addOnCreate() or nuke.addAfterFrameRender() with the root node.
from PySide2 import QtWidgets import nuke import nukescripts class TestPanel(QtWidgets.QWidget): pass def create_test_panel(): pane = nuke.getPaneFor('Properties.1') if not pane: return panel = nukescripts.panels.registerWidgetAsPanel( 'nuke.TestPanel', 'Test Panel', 'TestPanel', create=True ) panel.addToPane(pane) # Delay execution until UI is ready nuke.addOnCreate(create_test_panel, nodeClass='Root')Explore related questions
See similar questions with these tags.
