PySide2-uic how to specify the package from which to import resource file



  • HI,

    I am having resource file import error in py files generated with PySide2-uic. These errors are due to my project organization (in many folders), the ui files are organized in many folders and the resource file is in its folder also.

    When generating py files using PySide2-uic, is there any way to specify the package from which to import the resource file generated by PySide2-rcc?

    If you know pyuic5, a module that generates py files (using another Qt 5 python bindings: PyQt5) from ui files , this option is called "--import-from" and the command to generate py files is : pyuic5 --import-from=PACKAGE_NAME "ui_file_name" -o "py_file_name"
    Here PACKAGE_NAME is the package which contains the resource file.

    With PySide-uic the only option i saw is "--from-imports" and this one suppose that the resource file and the ui_files are in the same package, which is not true in my case.

    Is there any workaround or solution for my issue?

    Thank you for your help,


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    As a workaround, you should be able to use the code generated by pyuic5 with the Qt imports needing to be updated.

    For the missing feature(s), you should open a feature request on the bug report system.


Log in to reply