Hello,

A basic question that has me stumped. I'm using userSetup.py and I'm 
confused about scope. I've probably overcomplicated a simple task .. but 
I'm trying to understand how userSetup.py works so I've put part of my 
setup into a module. 

 userSetup.py contains the following:

import maya.cmds as cmds
print "--- Executing C:\Users\ben.c\Documents\maya\scripts\userSetup.py ---"
import eclipseConnection
eclipseConnection.startUpFunc()

eclipseConnection.py contains:

import maya.utils as utils

def startUpFunc():
print "--- Executing 
C:\Users\ben.c\Documents\maya\scripts\eclipseConnection.py ---"
if cmds.commandPort(':7720', q=True) !=1:
cmds.commandPort(n=':7720', eo = False, nr = True)

Firstly I don't ever see the result of the print commands on startup. Is 
this normal ?

Secondly and more importantly I find that when troubleshooting, if I 
manually execute eclipseConnection.startUpFunc() after startup, Maya 
reports: 

# Error: NameError: global name 'cmds' is not defined #

Now I would expect cmds to work fine within eclipseConnection as if I type 
'cmds' manually I see:

# Result: <module 'maya.cmds' from 'C:\Program 
Files\Autodesk\Maya2011\Python\lib\site-packages\maya\cmds\__init__.py'> # 


My questions are .. why don't I see the result of the print commands on 
startup (even though I know userSetup.py is running as cmds exists), and 
secondly why can't my module access maya.cmds even though I believe it be 
defined globablly ?

thank you
ben 

-- 
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