import bpy import os icons_collection = None icons_directory = os.path.split(os.path.dirname(__file__))[0] + '/icons' def get_icon_id(identifier): return get_icon(identifier).icon_id def get_icon(identifier): if identifier in icons_collection: return icons_collection[identifier] return icons_collection.load(identifier, os.path.join(icons_directory, identifier + ".png"), "IMAGE")