whats wrong with this syntax

24 views
Skip to first unread message

jettam

unread,
Oct 20, 2017, 9:06:15 PM10/20/17
to Python Programming for Autodesk Maya
I am trying to import this module but its not working.    The Module is called makeRobotBug. I assigned it to a variable called RB. 

RB = 'E:\ProfessionalDevelopment\python\Introduction to Python Scripting in Maya\cgcircuitPython\wk6\modules\makeRobotBug'
import RB

# ImportError: No module named RB # 

Phil Sloggett

unread,
Oct 20, 2017, 9:25:08 PM10/20/17
to Python Programming for Autodesk Maya
That’s not how import works - you don’t import strings (what you’ve done there is assign some string file path to RB then called import on that).

You call import on a module name that must be discoverable within your python path.

The module name is makeRobotBug, like you say, so that’s what you want to import ( and you can add “as RB” to assign it to RB afterwards). Then you just need to make sure it’s folder is in your python path (test this out by using sys.path.append )
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2eda30b5-4ee1-4a7c-b057-ae9ab8f223dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages