Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Organizing Pyside2 Code



  • Hi All,
    I need to organize files in subdirectories. but when i try to add new directory to main.pyproject file, it doesn't give access to its sub qml files.

    7f7aa882-bc34-40ef-8ebd-55a9d2de099e-image.png
    So how can i make subfolders containing components that can be used in main.qml ??



  • Need to organize main.qml file that imports nested files of subdirectories. If you have in main.qml:
    import "qmlFiles" as Uqmls
    then inside qmlFiles/ directory you have some.qml file and qmlDir, then there inside this file:
    import "qmlDir" as UDir
    Is better to organize by this way:

    1. dir/ of your main.qml file.
    2. dir/subdir/ for import from main.qml file
    3. dir/subdir/subdir/ for import from files that are in the dir/subdir/


  • Need to organize main.qml file that imports nested files of subdirectories. If you have in main.qml:
    import "qmlFiles" as Uqmls
    then inside qmlFiles/ directory you have some.qml file and qmlDir, then there inside this file:
    import "qmlDir" as UDir
    Is better to organize by this way:

    1. dir/ of your main.qml file.
    2. dir/subdir/ for import from main.qml file
    3. dir/subdir/subdir/ for import from files that are in the dir/subdir/

Log in to reply