beentheunseen
03-01-2011, 04:32 PM
Hey everyone,
In order to tidy up a script i'm currently working on, i'm trying to put some of my defs into external py files in the documents/maya/scripts directory and impor them into the script editor. So for example, I have a file called getNeighbors.py which contains a def called checkStreetAccess(), and i'm importing it into the main script editor with 'import checkStreetAccess' followed by 'print checkStreetAccess.checkStreetAccess(). However, I then get the following error:
# Error: NameError: file C:/Users/Ben-i7/Documents/maya/scripts\checkStreetAccess.py line 3: global name 'cmds' is not defined #
I have 'import maya.cmds as cmds' at the top of the external py files, as well as in the main script editor. Could anybody point out where i'm going wrong?
Thanks!
Ben
In order to tidy up a script i'm currently working on, i'm trying to put some of my defs into external py files in the documents/maya/scripts directory and impor them into the script editor. So for example, I have a file called getNeighbors.py which contains a def called checkStreetAccess(), and i'm importing it into the main script editor with 'import checkStreetAccess' followed by 'print checkStreetAccess.checkStreetAccess(). However, I then get the following error:
# Error: NameError: file C:/Users/Ben-i7/Documents/maya/scripts\checkStreetAccess.py line 3: global name 'cmds' is not defined #
I have 'import maya.cmds as cmds' at the top of the external py files, as well as in the main script editor. Could anybody point out where i'm going wrong?
Thanks!
Ben
