import importlib


def load_selected(text):
    """
    Load selected module or class in text

    text syntax:

        module
        package.module
        module::class

    Returns:
        A list of loaded objects
    """
    result = []
    for line in text.splitlines():
        if not line:
            continue
        if "::" in line:
            module, classname = line.rsplit("::", maxsplit=1)
            module = importlib.import_module(module)
            result.append(getattr(module, classname))
        else:
            result.append(importlib.import_module(line))
    return result