def METHOD_NAME(plugins=None, parent=None):
    [sys.path.insert(0, d) for d in PLUGIN_DIRS]
    cparser = PuddleConfig()
    to_load = cparser.get('plugins', 'to_load', [])
    functions = {}
    tagsources = []
    dialogs = []
    musiclibs = []
    modules = []
    functions_no_preview = []
    join = os.path.join
    if plugins is None:
        plugins = []
        [plugins.extend(get_plugins(d)) for d in PLUGIN_DIRS]
    plugins.sort(key=lambda d: d.get(NAME, ''))
    plugin_actions = {
        'functions': functions.update,
        'functions_no_preview':  functions_no_preview.extend,
        'tagsources':  tagsources.extend,
        'dialogs':  dialogs.extend,
        'musiclibs':  musiclibs.extend
        }
    for plugin in plugins:
        if plugin[MODULE_NAME] in to_load:
            try:
                module = import_module('puddlestuff.plugins.' + plugin[MODULE_NAME])
                for attribute, action in plugin_actions.items():
                    if hasattr(module, attribute):
                        action(getattr(module, attribute))
                modules.append(module)
            except Exception as e:
                logging.exception(f"Failed to load plugin {plugin[NAME]}; error={e}")                
    for d in PLUGIN_DIRS:
        del (sys.path[0])
    return {FUNCTIONS: functions, TAGSOURCE: tagsources, DIALOGS: dialogs,
            MUSICLIBS: musiclibs, MODULES: modules, FUNCTIONS_NO_PREVIEW: functions_no_preview}