导航

maya_关于脚本编辑器导入python模块

Posted on 2018-07-30 14:46  etoilest  阅读(1945)  评论(0)    收藏  举报

import sys

for p in sys.path:
print p

rigDir = 'C:\Users\lenovo\Documents\maya\scripts\python\rigLib'
if not rigDir in sys.path:
sys.path.append( rigDir )

from rigLib.base.control import *
ArmCtl = rigLib.base.control.Control(prefix = '1_arm')

 

问题与解决方法

# Error: line 1: 'module' object has no attribute 'base'
# Traceback (most recent call last):
# File "<maya console>", line 11, in <module>
# AttributeError: 'module' object has no attribute 'base' #

https://stackoverflow.com/questions/25575073/attributeerror-module-object-has-no-attribute-tests

 

之后再maya.env 文件中添加了PYTHONPATH = C:\Users\lenovo\Documents\maya\scripts\python

import rigLib
c = rigLib.base.control.Control()
c.Off

这样也同样可以导入模块