16 lines
346 B
Python
16 lines
346 B
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import importlib
|
|
import typing
|
|
|
|
|
|
def load_module_attribute(import_path: str) -> typing.Any:
|
|
module_path, attribute = import_path.split(':')
|
|
|
|
module = importlib.import_module(module_path)
|
|
if attribute is not None:
|
|
return getattr(module, attribute)
|
|
|
|
return module
|