This repository has been archived on 2023-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
jarvis-server/jarvis/utils/utils.py

13 lines
335 B
Python
Raw Permalink Normal View History

import importlib
def import_method_from_string(file, method_name):
"""
2021-07-27 12:37:09 +02:00
Add the possibility to import method dynamically using a string like "skills.daily.date_and_time.intent" as file and
"what_time_is_it" as method_name
"""
mod = importlib.import_module(file)
met = getattr(mod, method_name)
return met