Can't get object by it's name


#1

I need to check object from my array by it outMesh listConnections.
Let’s consider this example:

string $stuff =“pCylinder1”; // this is existing object
string $connections[] = listConnections $stuff.outMesh; // should show connection from variable but I doesn`t
print $connections;

However code only check Connections on currently selected object, ignoring variable $stuff,
if selection is empty or I object pCylinder1 dont exist, after running code I got Error: No object matches name: .outMesh I don't want to select object $stuff to make this code work, I also could use:listConnections $pCylinder1.outMesh; but I require to use different object name as variable to check it `listConnections .
What I’m doing wrong here?


#2

try
string $connections[] = listConnections ($stuff+".outMesh");