I have been trying to build a plugin through Plugin Builder 3 and been facing this issue then.

I have been facing the pyrcc5 issue but I was able to solve it through this link: Fixing “The resource compiler pyrcc5 was not found”

This is the Python error:

Couldn't load plugin split_layer' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'split_layer.resources'
Traceback (most recent call last):
  File "C:/PROGRA-1/QGIS3~1.3/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins [packageName] = package.classFactory (iface)
  File "C:/Users/pabla/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\split_layer\ _init_ .py", line 35, in classFactory
    from .split_layer import Split_Layer
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./pychon\qgis\utils.py", line 737, in _import
    mod = _builtin_import (name, globals, locals, fromlist, level)
  File "C:/Users/pabla/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\splic_layer\splic_layer.py", line 26, in
    from .resources import *
  File "C:/PROGRA~1/QGIS3~1.8/apps/qgis/./pychon\qgis\utils.py", line 737, in _import
    mod = _builtin_import (name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'split_layer.resources'

Can anyone help me how to solve this error?

  • Does resources.py exist in your plugin folder? Jan 31, 2020 at 7:35
  • Yes it is there in the pluginbuilder3 folder but not in the plugin that i have build(i.e split layer folder ) in that there is only resources.qrc Jan 31, 2020 at 8:23
  • 1
    You have to copy resources.py in folder created by pluginbuilder into QGIS plugin folder. Jan 31, 2020 at 8:31
  • The problem is solved and please comment down so that i can accept your answer :) :). Jan 31, 2020 at 8:34
  • 1
    @KadirŞahbaz I've re-opened on basis of your comment. Thank you for replacing the code picture with formatted text.
    – PolyGeo
    Jan 31, 2020 at 10:40

1 Answer 1


While building a plugin for QGIS using Plugin Builder, if you get ModuleNotFoundError: No module named '... .resources' error after running Makefile, you should first check if resources.py exists in the folder (source folder) created by Plugin Builder. If it does, copy that file into your plugin folder in QGIS plugin folder (target folder).

If there is no resources.py file in the source folder, then, run next code to create resources.py from resources.qrc.

pyrcc5 -o resources.py resources.qrc

And copy resources.py file into target folder or run Makefile again.

Note: You can copy all plugin files into target folder manually without running Makefile. But still, you will need resources.py file. Therefore, you have to generate it via pyrcc5.


Your Answer

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

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