If you create a shader node via scripting without specifying “asShader=True” (there may be gui ways of getting the same effect), you may find that said nodes don’t appear in the top hypershade tabs. Maddening.

There’s no need to nuke the nodes and start again – they can be fixed in place. There’s a number of hidden sets that the hypershade tabs rely upon, so it’s trivial to reconnect them. Code below – select the offending nodes, and run this.

import maya.cmds as cmds

def fixShadingNodes(inNode):
    target = None
    
    nodeType = cmds.nodeType(inNode)
    if cmds.getClassification(nodeType, satisfies="shader"):
        target = 'defaultShaderList1.shaders'
    elif cmds.getClassification(nodeType, satisfies="texture"):
        target = 'defaultTextureList1.textures'
    elif cmds.getClassification(nodeType, satisfies="utility"):
        target = 'defaultRenderUtilityList1.utilities'
    
    if target:
        cmds.connectAttr(sel + '.message', target, na=True, force=True)

for sel in cmds.ls(sl=True):
    fixShadingNodes(sel)
    

Or apply it to all instances of a node type

for x in cmds.ls(type='aiImage'):
    fixShadingNodes(x)