it doesn t work at all
i really dont what is going on there !
i made a simple script to illustrate the problem: within 2 files only, inside a folder called myCustomIcons !
__init__.py
bl_info = {
"name": "myCustomIcons",
"author": "Author name",
"version": (1, 7, 2),
"blender": (2, 80, 0),
"location": "3D View > Tools > N panel",
"description": "Addon for blender 2.8",
"category": "ADDON_X"}
# import ui.py
if "bpy" in locals():
import imp
imp.reload(ui)
else:
from . import ui
import bpy
import os
from os import path
icon_dir = path.join(path.dirname(__file__), "icons")
preview_collections = {}
# define classes to register from ui.py
classes = (
ui.VIEW3D_PT_my_panel,
)
def register():
# register icon dict
import bpy.utils.previews
pcoll = bpy.utils.previews.new()
icons = {"blogo" : "BLOGO16.png",
}
for key, f in icons.items():
pcoll.load(key, path.join(icon_dir, f), 'IMAGE')
preview_collections["main"] = pcoll
# Register Classes
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
# Unregister classes
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
# Unregister icons preview
for pcoll in preview_collections.values():
bpy.utils.previews.remove(pcoll)
preview_collections.clear()
if __name__ == "__main__":
register()
and the ui.py
that contains my panel with the use of the supposed custom icon !
import bpy, os
from bpy.types import Panel
# Panel for project settings panel
class VIEW3D_PT_my_panel(Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_label = "custom icons"
bl_idname = "VIEW3D_PT_cicon_panel"
bl_category = "Templates"
#bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
row = col.row(align=True)
from myCustomIcons.icons import preview_collections
pcoll = preview_collections["main"]
icon = pcoll["blogo"]
row.label("", icon_value=icon.icon_id)
and i got a folder called “icons” in the addon main folder !
It doesn´t work ! it suppoed to be easy and reliable, but i cant figure out why !
please, tell me where i am wrong… thanks a loooooot ! 
the error in the console:
Traceback (most recent call last):
File "C:\Users\WIN10PRO\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\script custom icons\ui.py", line 21, in draw
from myCustomIcons.icons import preview_collections
ModuleNotFoundError: No module named 'myCustomIcons'
location: <unknown location>:-1
BUT, how it doesnt know the name of the main module aka “the name of the addon” aka init?