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/utils/utils.py

13 lines
335 B
Python
Raw Normal View History

import importlib
def import_method_from_string(file, method_name):
"""
Add the posibility to import method dynamically using a string like "intents.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