Fail in applying materials to a paraview object - vtkOSPRayMaterial error

Hi, I’m trying to apply material properties to active objects in a paraview session through python.
The premise is that if I execute the steps manually I can get the materials correctly in place. If I emulate the python trace through an external script I get the following error:

> Generic Warning: In vtkOSPRayMaterialHelpers.cxx, line 358
> Warning: unrecognized material “”, using a default obj

This is the script I’m using:

materialLibrary1 = GetMaterialLibrary()
materialLibrary1.LoadMaterials = '*path_to_material/library.json*'
renderView1.OSPRayMaterialLibrary = materialLibrary1 
renderView1.EnableRayTracing = 1
renderView1.BackEnd = 'OSPRay pathtracer'
renderView1.SamplesPerPixel = 4
obj = GetActiveSource()
obj_display = GetDisplayProperties(obj,view=renderView1)
obj_display.OSPRayMaterial = 'Material_Name'

Did anyone face similar issues?

What do you mean by this exactly ?

I get the syntax of the commands that I execute manually through Tools > Start Trace and then copy these very same instructions in a blank script. When I execute this script in paraview through the python shell I get the error described above.