Can't import Qt for Python in Maya 2018/2019


#1

Hi CGS,

I am trying to build a small UI in Maya with QT through Python.

When I use " from Qt import QtCore " In the script editor, it throws the following error:
Error: ImportError: file line 2: No module named Qt #

I am just starting out to explore this subject. Does this mean Qt isn’t installed ? Is it not a part of the default package of Maya 2018 and 2019 ?

Any pointers as to why this may happen will be really helpful.

Thank you!
Sravan


#2

You have to use PySide2 these days, for example:

from PySide2 import QtCore
from PySide2 import QtWidgets
from shiboken2 import wrapInstance

Searching for “pyside2 maya” should net you some tutorials/source code.