From 049e1f064af76cad82182b1746c8d9a4cbfde7c7 Mon Sep 17 00:00:00 2001
From: Shubham Gupta <shubhamgupta3121@gmail.com>
Date: Tue, 9 Apr 2024 14:52:09 +0530
Subject: [PATCH] fix scope of loading the registering the action based lib
 objects

---
 packages/syft/src/syft/service/service.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/packages/syft/src/syft/service/service.py b/packages/syft/src/syft/service/service.py
index d9157a4be5f..fee806c440c 100644
--- a/packages/syft/src/syft/service/service.py
+++ b/packages/syft/src/syft/service/service.py
@@ -226,14 +226,15 @@ def register_lib_obj(lib_obj: CMPBase) -> None:
 
             LibConfigRegistry.register(lib_config)
 
-    # hacky, prevent circular imports
-    for lib_obj in action_execute_registry_libs.flatten():
-        # # for functions
-        # func_name = func.__name__
-        # # for classes
-        # func_name = path.split(".")[-1]
-        if isinstance(lib_obj, CMPFunction) or isinstance(lib_obj, CMPClass):
-            register_lib_obj(lib_obj)
+
+# hacky, prevent circular imports
+for lib_obj in action_execute_registry_libs.flatten():
+    # # for functions
+    # func_name = func.__name__
+    # # for classes
+    # func_name = path.split(".")[-1]
+    if isinstance(lib_obj, CMPFunction) or isinstance(lib_obj, CMPClass):
+        register_lib_obj(lib_obj)
 
 
 def deconstruct_param(param: inspect.Parameter) -> dict[str, Any]: