Okay so I here is the easiest approach, just change from importing QtWidgets by PySide6 and use PyQt6 instead it works just fine as shared in the image snapshot of the pyqtgraph code
from PyQt6 import QtWidgets