import importlib


def import_from_dotted_path(path):
    """
    Import an object (class/module/etc) from a python path string.

    The path must have at least one dot.
    """
    try:
        module_path, attr = path.rsplit('.', 1)
    except ValueError:
        message = 'An import path with two or more components is required.'
        raise ValueError(message) from None

    module = importlib.import_module(module_path)
    return getattr(module, attr)