Feedback

What's your question?

By: Asked from India

How can I call a method on a python object through mel?

Hi,

How to resolve this. 

Following error occurs from maya. I am doing the following in Filemenu.mel file. this runs at the startup.

python("import saveCentral_fromPath"); . . .

global proc runSaveCentral() {

python("saveCentral_fromPath.saveCentral()");
python("a._first_()");  

}

. . . menuItem -label ("save Central") -en 1 -annotation ("publish : copy to central area") -command ("runSaveCentral()") publishItem;

# Error: file: S:/xxxxxxxx/scripts/maya/melTEST/FileMenu.mel line 64: class saveCentral_fromPath has no attribute 'saveCentral'
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# AttributeError: class saveCentral_fromPath has no attribute 'saveCentral' # 

Brgds,

kNish

Add comment viewed 280 times Latest activity 10 months ago

or Cancel

1 answer

  • 0

haggi

I suppose that because you are in an windows environment, the import is not known in the gobal proc runSaveCentral(). You have to put the import into the global proc.

or Cancel