I'm just trying out Maya 2017 and seen that they've gone over to PySide2
, which is great but all of my tools have import PySide
or from PySide import ...
in them.
The obvious solution would be to find/replace import PySide
to import PySide2
and hope everything still works after that, but I'd still like to be able to support older versions of Maya.
My idea was to have a single line solution to find/replace like:
import (PySide2 if "PySide2" in sys.modules else PySide)
But this returns: Error: invalid syntax
Does anyone have any ideas for an alternative to this? I'd like to try and keep it on a single line so it's an easy replacement for when I've got conditions like:
from PySide import QtCore, QtGui
Thank you!