Is this code literally attached as the menu command or are you importing and 
running it?

If this is the complete code, then you don't really need the class structure 
(or a method called __main__)

# import x
# import y, z
def createLayer():
    objsetInt = setInternals.setInternals()
    objsetInt.evalInt()
    obj1 = renderLayerCreate.renderLayerCreate()
    obj1.wu()
    return obj1

Then your menu can do something like:
import createLayerScript; createLayerScript.createLayer()



On Oct 19, 2012, at 3:47 AM, nish <[email protected]> wrote:

> following script runs once when called from maya -> menu -> menuItem. However 
> when clicking again it does not run. 
> What do i do to make it run again and again.
> 
> import maya.cmds as cmds
> import maya.mel as mel
> import maya.utils as utils
> mel.eval('source "renderLayerBuiltinPreset.mel"')
> mel.eval('source "createMentalRayIndirectLightingTab.mel"')
> from _python import renderLayerCreate
> from _python import setInternals
> class renderLayer():
>       def __main__(self):
>               objsetInt = setInternals.setInternals()
>               objsetInt.evalInt()
>               obj1 = renderLayerCreate.renderLayerCreate()
>               obj1.wu()
> 
> aaa = renderLayer()
> aaa.__main__()
> 
> 
> is app scope applicable in this case.
> will making it a plugin in python help 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to