from Qt import QtWidgets, QtCore, QtGui
import pymel.core as pm
class ObjectManager(QtWidgets.QDialog):
def __init__(self):
super(ObjectManager, self).__init__()
def showUI():
ui = ObjectManager()
ui.show()
return ui
import assetManager
reload(assetManager)
ui = assetManager.showUI()
# Error: AttributeError: file <maya console> line 1: 'module' object has no attribute 'showUI' #
Try print(assetManager)
to find out where the file actually resides on disk, and make sure it’s the file you expect.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
print(assetManager)
<module 'assetManager' from 'C:\Users\jason\Documents\maya\2017\scripts\assetManager.pyc'>
Yes, try something like this.
import sys
sys.path.insert(0, r"C:\Users\jason\Documents\maya\2018\scripts")
import assetManager
sys.path
is a list of all directories Python will look for modules, prior to importing it for the first time. It’s a somewhat forceful way of achieving it however, it’s likely something is not right with your setup.
Have a look at what your PYTHONPATH
looks like.
import os
print(os.getenv("PYTHONPATH"))
PYTHONPATH
(may) contain paths that is eventually parsed into sys.path
.
If it contains anything, then that is where Python will look for your modules. Next is having a look at your maya.env
file of your user directory, that can safely be empty. If neither of those have any content, then something more murky is happening. Maya should be able to find scripts from its own scripts directory without any interference. If all else fails, remove/move your Documents\maya
directory elsewhere, such that Maya can create a new one without any customisations.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b0645cb5-11a4-439a-8dac-891675411e17%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ah, well you can spot the order in which directories are evaluated by looking at the order of paths in sys.path
. You should find that the 2017 folder is before the 2018 folder. This shouldn’t be Maya’s doing, but rather something happening elsewhere. 2018 shouldn’t know about 2017, nor any other version before it.
Ps. I use the word “should” rather than “is” because sometimes Maya simply goes bananas. :)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b0645cb5-11a4-439a-8dac-891675411e17%40googlegroups.com.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/09e6f9c7-67fe-406c-902f-8891b23cfe39%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b0645cb5-11a4-439a-8dac-891675411e17%40googlegroups.com.