Passing Com Object between Custom Nodes

I am writing some custom nodes to make use of a software package that has COM interface. The first step in the process is to create the COM object and then load a file to create a “session” in the software. This session then needs to be passed between all other custom nodes. I have this working to some extent but when I try to have 1 custom node to load the session and pass the resulting com object to another custom node, I get some strange behaviour. The custom nodes will be using python. My first custom node to load the session looks like this:

import clr
import sys
import System

t = System.Type.GetTypeFromProgID("myComObject")
o = System.Activator.CreateInstance(t)



The file name to load is passed in to this.

I have a custom node that creates the com object, loads the session and returns the object:

If I then create a simple python code block and pass this com object to the python IN[0], i can make use of it and do everything I need and get meaningful results from the com object. Like this:

where the script is like this (well much more than this really but for purposes of demonstration)

o = IN[0];

I then want to create a custom node from the second script. I do this and need to create the 2 input variables.

So the first question is what type should I give to the com object input? I’ve tried var, System.Object, System.__ComObject (not recognised). With var this gives a strange result:

The watch window always just says “Function”

If I remove the first input complety from the custom node and then load the com object in the script, it works again. Something about passing the com object into the custom node causes the output to always be set to “Function”. Even if I have the most basic script:


But still have the com input, it still says “Function” in the watch. Hope you can help.

Could this be due to receiving a list rather than an item once you move into the custom node?

not really sure what you mean by that but I don’t think thats what happening. Are you saying it puts the object into a list of length one?

1 Like