'module' object has no attribute .....

199 views
Skip to first unread message

s...@weacceptyou.com

unread,
Aug 6, 2016, 6:28:34 PM8/6/16
to Python Programming for Autodesk Maya
hello there,

i have a main module which is running and at some point needs to import a function from another module (in another folder). I have imported the module:

import samDev.rigging.TOPOCOAT.utility_functions.general as general
reload(general)

and the function i need from that module gets called like this:

general.make_maya_component(mesh,face_indexes)

However the error that is returned is this:

'module' object has no attribute 'make_maya_component'

This is weird because other functions from my 'general' module have been called from other modules and it worked fine. Im not sure what this error means.

can anyone help me out,
thanks

Sam

Justin Israel

unread,
Aug 6, 2016, 6:57:49 PM8/6/16
to Python Programming for Autodesk Maya

It will be difficult to give you an exact cause without having the entire project structure and source code available.  But here are some thoughts.

Do you have any circular dependencies between this module and the general one?

Where are you making this function call? Is it in another function?

If you print the general module and also the results of "dir(general)", are they what you would expect?

Justin


--
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/070bce17-bff6-4119-9d93-eeb728111937%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

s...@weacceptyou.com

unread,
Aug 7, 2016, 8:39:23 AM8/7/16
to Python Programming for Autodesk Maya
i think its probably that circular dependencies thing. I made another module in same folder with a function to print something and it worked fine from my main module.

But i can't figure out how there might be a circular dependency because the general module just has a load of individual functions which perform simple tasks (that dont depend on anything else).

i will have to go through step by step and try and figure out where i breaks.

thanks Justin,
Sam

33th...@gmail.com

unread,
Aug 7, 2016, 9:36:29 PM8/7/16
to Python Programming for Autodesk Maya, s...@weacceptyou.com
you can try something like this to help narrow down the issue

for d in dir(general):
print d

I'd check spelling first ;)
goodluck!
Reply all
Reply to author
Forward
0 new messages