def import_settings(dotted_path):
    """Import settings instance from python dotted path.

    Last item in dotted path must be settings instance.

    Example: import_settings('path.to.settings')
    """
    if "." in dotted_path:
        module, name = dotted_path.rsplit(".", 1)
    else:
        raise click.UsageError(
            f"invalid path to settings instance: {dotted_path}"
        )
    try:
        with redirect_stdout(None):
            module = importlib.import_module(module)
    except ImportError as e:
        raise click.UsageError(e)
    except FileNotFoundError:
        return
    try:
        return getattr(module, name)
    except AttributeError as e:
        raise click.UsageError(e)
Import settings instance from python dotted path.

    Last item in dotted path must be settings instance.

    Example: import_settings('path.to.settings')
    
dynaconf/cli.py