I know it is possible to associate a layer with a custom UI for editing feature attributes using the QGIS interface by using python:


And I found this to associate the vector layer with python init method:


But this only allowed when the module (python file) located in the same directory as my project. Is there any ways to load from external file?

  • between, i'm using QGIS 2.18
    – Cy T
    Commented Nov 15, 2016 at 10:09

1 Answer 1


I had the same issue, but I found a way to avoid it. I just set the right external file to my Style (.qml) and I do use Layer.setEditForm() and Layer.setEditFormInit() and it works perfectly!

  • Cy T does anything worked out for you ? if yes can you accept the answer or share your experience ? it will be valuable for other. Thanks. Commented Feb 22, 2017 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.