i got this error when i run my first api code .. can anyone help me please !

--------------------------
the error :

Error: TypeError: file 
C:/Users/abdelhalim.abdo/Documents/maya/2024/plug-ins/api_learning.py line 
26: argument 1 must be OpenMaya.MObject, not MObject #

-----------------

the code :


import maya.api.OpenMaya as om

import maya.cmds as cmds



def use_NewAPI():

pass


class MyCmd(om.MPxCommand):

NAME = 'heycmd'

def __init__(self):

super(MyCmd, self).__init__()

def doIt(self, args):

print('this my first cmd :)')

@classmethod

def c(cls):

return MyCmd()


def initializePlugin(p):

vendor = 'abdo'

version = '1.0.0'

mfn = om.MFnPlugin(p, vendor, version)

mfn.registerCommand(MyCmd.NAME, MyCmd.c)

def uninitializePlugin(p):

mfn = om.MFnPlugin(p)

mfn.deregisterCommand(MyCmd.NAME)



if __name__ == "__main__":
    
    p_name = 'api_learning.py'
    cmds.evalDeferred(f'if cmds.pluginInfo("{p_name}", q=1, loaded=1): 
cmds.unloadPlugin("{p_name}")')
    cmds.evalDeferred(f'if not cmds.pluginInfo("{p_name}", q=1, loaded=1): 
cmds.loadPlugin("{p_name}")')


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/ee6a4d53-823c-4c06-a9a0-c7d53f4219c4n%40googlegroups.com.

Reply via email to