Ah, that’s interesting.

qApp <https://doc.qt.io/qt-5/qapplication.html#qApp> is the actively
running instance of a QApplication; you could alternatively call
QtWidgets.QApplication.instance()
<https://doc.qt.io/qt-5/qcoreapplication.html#instance>. Maya is bound to
have just one, but it seems that, based on your description, userSetup.py
executes *before* Qt starts running (sometimes?).

I would pass the entire thing, e.g. by wrapping it into a function, through
cmds.evalDeferred or Qt.QtCore.QTimer.singleShot, that should give Qt
enough time to catch up.
​

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAJCwQ%2B1MRtcYZyGLEfL4z%2BGRxMY7W0p8yNNBftW-MRtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to