I’m using sensor conveyor to detect what kind of parts are going trough the conveyor and then I want to append certain types of parts to a list. The entire script is pretty long as there is lot of other things happening in the script but in short this is how I try to get the name:
sensor = app.findComponent(“Sensor Conveyor”)
sensor_signal = sensor.findBehaviour(“SensorSignal”)
and then later I try to read the name into a variable
part = sensor_signal.Value
and then I use part.Name when I want to know the name of the part but for some reason it is not working even though I have used this exactly same way before in different simulation and it worked perfectly then.
When I do “print part” and “print part.Name” it prints out <vcComponent object at 0x00000214CA278168> and the correct part name but then it also prints None and gives the error AttributeError: ‘NoneType’ object has no attribute ‘Name’. So what is going on? It prints out the correct name even though it complains it doesn’t exist? For a time it was also appending correct names to a list even though it was giving the same error and then suddenly it just stopped working. I have no idea what is causing this.