Importing ghpythonlib.components second time ERROR

Strange behaviour that I cant understand:
In my script I got import ghpythonlib.components as ghc and when loaded for the first time it loads like this:

 * Loading Grasshopper core assembly...
 * Loading CurveComponents assembly...
 * Loading FieldComponents assembly...
 * Loading GalapagosComponents assembly...
 * Loading IOComponents assembly...
 * Loading Kangaroo2Component assembly...
 * Loading MathComponents assembly...
 * Loading ScriptComponents assembly...
 * Loading SurfaceComponents assembly...
 * Loading TriangulationComponents assembly...
 * Loading VectorComponents assembly...
 * Loading XformComponents assembly...
 * Loading GhPython assembly...

but script works fine, no problems (oh oh oh this marvelous TriRemesh :kissing_smiling_eyes: :kiss: :heart_eyes:).
Ok, if I close my scripts Eto interface and launch it once again it throws this Error:

No module named GhPython.Assemblies
Traceback:
  line 1, in <module>, "C:\Users\... IronPython... \lib\ghpythonlib\componentbase.py"
  line 13, in <module>, "C:\Users\... IronPython... \lib\ghpythonlib\__init__.py"
  line 12, in <module>, .....myscript.py

Why is that?

Please help, because I really suffer as I have to restart Rhino every time to run my script.
Also… can I load only Kangaroo2Component assembly with something like that ?

from ghpythonlib.components import Kangaroo2Component

or it has to be loaded all of Grasshopper component libraries in any case?
Basicly all I need is TriRemesh…

Is that UI maybe throwing exceptions when it closes? Are you doing some operations (registering callbacks) when it closes? It sounds like something that might have to do with some problems that happen then. By itself, closing an Eto UI form should have no ramifications.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

@Giulio, thank you for reply.
you can simply reproduce this behaviour. All I have done is this code of SampleEtoModelessForm.py with addition

import ghpythonlib.components as ghc

and it doesnt load for the second time…

This problem has nothing to do with ETO…
my code has single line : import ghpythonlib.components as ghc
It loads for first time code start, and does not for the following :frowning:

Command: CodeListener
VS Code Listener Started...
Command: -_EditPythonScript
>>> ( Debugging=On ): Debugging=Off
>>> ( Debugging=Off ): (
C:\...\AppData\Local\Temp\resetscriptengine.py
)
Python script engine has been reset.
Grasshopper has started loading all component libraries
 * Loading Grasshopper core assembly...
 * Loading CurveComponents assembly...
 * Loading FieldComponents assembly...
 * Loading GalapagosComponents assembly...
 * Loading IOComponents assembly...
 * Loading Kangaroo2Component assembly...
 * Loading MathComponents assembly...
 * Loading ScriptComponents assembly...
 * Loading SurfaceComponents assembly...
 * Loading TriangulationComponents assembly...
 * Loading VectorComponents assembly...
 * Loading XformComponents assembly...
 * Loading GhPython assembly...
Command: -_EditPythonScript
>>> ( Debugging=On ): Debugging=Off
>>> ( Debugging=Off ): (
C:\...\AppData\Local\Temp\resetscriptengine.py
)
Python script engine has been reset.
No module named GhPython.Assemblies
Traceback:
  line 1, in <module>, "C:\...\settings\lib\ghpythonlib\componentbase.py"
  line 13, in <module>, "C:\...\settings\lib\ghpythonlib\__init__.py"
  line 1, in <module>, "C:\...\AppData\Local\Temp\TempScript.py"
Command: -_EditPythonScript
>>> ( Debugging=On ): Debugging=Off
>>> ( Debugging=Off ): (
C:\...\AppData\Local\Temp\resetscriptengine.py