what was the error message you were getting? I see in your script a reference to OP which would cause an error like this:
td.tdError: OP object expected. Value:'/project1/constant5' Type:<class 'str'>.
Results of run operation resulted in exception.
Traceback (most recent call last):
File "</project1/text4:op('/project1/text4').run()>", line 1
td.tdError: td.tdError: Invalid OP object. The node this python object referenced has likely been deleted.
The above exception was the direct cause of the following exception:
File "/project1/text4", line 4
SystemError: <built-in method setInputs of td.layoutTOP object at 0x00000241D82E7780> returned a result with an error set
Results of run operation resulted in exception.
using instead op and making sure that the operators are in the same network as the Layout TOP would make this work properly.
Another option would be to dump a list of paths into the operator’s TOPs parameter. This would allow to reference operators from all kind of places in the file.