5858
5959modules = [tup [1 ] for tup in pkgutil .iter_modules ()]
6060
61- python_grpc_wrapper = None
62-
6361
6462@pyaedt_function_handler ()
6563def launch_aedt (full_path , non_graphical , port , student_version , first_run = True ):
@@ -239,7 +237,6 @@ def _close_aedt_application(desktop_class, close_desktop, pid, is_grpc_api):
239237 ``True`` when successful, ``False`` when failed.
240238
241239 """
242- global python_grpc_wrapper
243240 if settings .remote_rpc_session or (settings .aedt_version >= "2022.2" and is_grpc_api and not is_ironpython ):
244241 if close_desktop and desktop_class .parent_desktop_id :
245242 pyaedt_logger .error ("A child desktop session is linked to this session." )
@@ -273,9 +270,8 @@ def _close_aedt_application(desktop_class, close_desktop, pid, is_grpc_api):
273270 return False
274271 else :
275272 try :
276- if not python_grpc_wrapper :
277- python_grpc_wrapper = __import__ ("pyaedt.generic.grpc_plugin" )
278- # import pyaedt.generic.grpc_plugin as StandalonePyScriptWrapper
273+ import pyaedt .generic .grpc_plugin as python_grpc_wrapper
274+
279275 python_grpc_wrapper .AedtAPI .ReleaseAll ()
280276 return True
281277 except Exception : # pragma: no cover
@@ -911,7 +907,6 @@ def _initialize(
911907 version = None ,
912908 is_grpc = True ,
913909 ):
914- global python_grpc_wrapper
915910 if not is_grpc :
916911 from pyaedt .generic .clr_module import _clr
917912
@@ -934,10 +929,8 @@ def _initialize(
934929 os .environ ["DesktopPluginPyAEDT" ] = os .path .join (settings .aedt_install_dir , "PythonFiles" , "DesktopPlugin" )
935930 launch_msg = "AEDT installation Path {}" .format (base_path )
936931 self .logger .info (launch_msg )
937- if not python_grpc_wrapper :
938- python_grpc_wrapper = __import__ ("pyaedt.generic.grpc_plugin" )
939- python_grpc_wrapper = python_grpc_wrapper .generic .grpc_plugin
940- # import pyaedt.generic.grpc_plugin as StandalonePyScriptWrapper
932+ import pyaedt .generic .grpc_plugin as python_grpc_wrapper
933+
941934 if _desktop_sessions :
942935 last_session = list (_desktop_sessions .values ())[- 1 ]
943936 all_desktop = [i for i in last_session .odesktop .GetRunningInstancesMgr ().GetAllRunningInstances ()]
0 commit comments