Python: Cannot find reference 'uic' in'_init_.pyi |_init_.pyi

Viewed 5340

Iam trying to import PyQt5.uic to load UI file into pycharm python script, but get error: cannot find reference 'uic' in'init.pyi |init.pyi
I tried many solutions like invaildate caches and restart, and unistall older version from python and keep my currrent version which 3.9

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import * 
from PyQt5.uic import loadUiType # error appears here
1 Answers

I kind of fixed the problem, The problem was from the PyCharm it self there is no problem in PyQt5 or python version, When i tried it on VSCode i got no problems in the code, if you want to solve it on PyCharm it's easy, Just keep writing the code!
It's bug from the Pycharm there is no actullay error as i noticed above, So the code will be like that in pycharm:

import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.uic import loadUiType #error appears here
import os
from os import path

FORM_CLASS, _ = 
loadUiType(path.join(path.dirname(__file__), 
"Theme.UI")) # there is no error here!

And run the code it will work!

Related