I am trying to update my scripts that was using PySide2 and make them work 
in maya 2025 or later 

So I thought it would be better if I change PySide Version as String then 
import it 
But I got the feeling that its not the neatest way !!

If you have any Ideas to make this better without the need to install any 
packages that maya doesn't support  

Here's My Code 
# =====================================
import importlib
import maya.OpenMayaUI as Omui
 
maya_version = cmds.about(version=True)

# 
====================================================================================
# DEFINE  PYSIDE VERSION
qt_widgets = "PySide2.QtWidgets" if int(maya_version) < 2024 else 
"PySide6.QtWidgets"
qt_core = "PySide2.QtCore" if int(maya_version) < 2024 else "PySide6.QtCore"
shibokenV = "shiboken2" if int(maya_version) < 2024 else "shiboken6"
# 
====================================================================================

# ======================================================
# ATTEMPT TO IMPORT 
a = importlib.import_module(qt_widgets)
b = importlib.import_module(qt_core)
c = importlib.import_module(shibokenV)
# ======================================================

# ======================================================
# Getting Maya Main Window
maya_main_window_ptr = Omui.MQtUtil.mainWindow()
V = c.wrapInstance(int(maya_main_window_ptr), a.QWidget)
# ======================================================

# =============
# TEST 
x = a.QDialog()
x.show()
# =============



-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/python_inside_maya/363c2368-4824-4200-9a54-a5776e06fa29n%40googlegroups.com.

Reply via email to