No module named mymodule on import

188 views
Skip to first unread message

Matheus Lima

unread,
Nov 30, 2020, 11:21:20 AM11/30/20
to Python Programming for Autodesk Maya
Hi!

So I'm a bit new to Python in Maya, and I'm trying to import a script from a folder called 'matheuslima' that is inside my Maya scripts directory like this:

from matheuslima import ml_twist_bones_ui

The error I get:
no module named matheuslima

Even though the folder is in \Documents\maya\2020\scripts\matheuslima
If the script is out of the folder (only in scripts directory), it works fine like this:

import ml_twist_bones_ui

But inside the folder, Maya can't locate it. What I'm missing? Thanks!

Michael Eden

unread,
Nov 30, 2020, 11:42:09 AM11/30/20
to python_in...@googlegroups.com
You need to create another file inside your script folder named "__init__.py" it can be empty, or you can write something inside, up to you. but the name is fixed, so don't change, delete or rename that file. 

--
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/78f30289-19c6-4f5e-a3b9-3635ff082920n%40googlegroups.com.

Matheus Lima

unread,
Nov 30, 2020, 11:49:12 AM11/30/20
to Python Programming for Autodesk Maya
It worked, thank you! Silly mistake, sorry. xD
Reply all
Reply to author
Forward
0 new messages