58
58
59
59
modules = [tup [1 ] for tup in pkgutil .iter_modules ()]
60
60
61
- python_grpc_wrapper = None
62
-
63
61
64
62
@pyaedt_function_handler ()
65
63
def 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):
239
237
``True`` when successful, ``False`` when failed.
240
238
241
239
"""
242
- global python_grpc_wrapper
243
240
if settings .remote_rpc_session or (settings .aedt_version >= "2022.2" and is_grpc_api and not is_ironpython ):
244
241
if close_desktop and desktop_class .parent_desktop_id :
245
242
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):
273
270
return False
274
271
else :
275
272
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
+
279
275
python_grpc_wrapper .AedtAPI .ReleaseAll ()
280
276
return True
281
277
except Exception : # pragma: no cover
@@ -911,7 +907,6 @@ def _initialize(
911
907
version = None ,
912
908
is_grpc = True ,
913
909
):
914
- global python_grpc_wrapper
915
910
if not is_grpc :
916
911
from pyaedt .generic .clr_module import _clr
917
912
@@ -934,10 +929,8 @@ def _initialize(
934
929
os .environ ["DesktopPluginPyAEDT" ] = os .path .join (settings .aedt_install_dir , "PythonFiles" , "DesktopPlugin" )
935
930
launch_msg = "AEDT installation Path {}" .format (base_path )
936
931
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
+
941
934
if _desktop_sessions :
942
935
last_session = list (_desktop_sessions .values ())[- 1 ]
943
936
all_desktop = [i for i in last_session .odesktop .GetRunningInstancesMgr ().GetAllRunningInstances ()]
0 commit comments