From 1deaa758ce21a9f54ba3248e6b3b367cd3b7a729 Mon Sep 17 00:00:00 2001 From: Leon Riesebos Date: Sat, 27 Feb 2021 15:05:02 -0500 Subject: [PATCH] get_experiment() is able to get nested experiment classes using dots in class names. Signed-off-by: Leon Riesebos --- artiq/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/artiq/tools.py b/artiq/tools.py index 0cf0ad56b..167f8cf74 100644 --- a/artiq/tools.py +++ b/artiq/tools.py @@ -89,7 +89,10 @@ def file_import(filename, prefix="file_import_"): def get_experiment(module, class_name=None): if class_name: - return getattr(module, class_name) + obj = module + for name in class_name.split('.'): + obj = getattr(obj, name) + return obj exps = inspect.getmembers(module, is_public_experiment)