Object display mode (with GUID) using python script

I found this:

I have to apply “ghosted” mode for 100 objects. From this script I need to select the display mode for every single object (which I want to avoid).

I don’t want to change the display mode by selecting the object in Rhino. I want to create the object using script and change the display mode at the same time (similar to “setobjectdisplaymode” option).

Here is code snippet:

Hi @Kanika_Rajain ,
you can use RhinoCommon to override the display mode for your object as follows:

import rhinoscriptsyntax as rs
import Rhino

ghostedMode = Rhino.Display.DisplayModeDescription.GetDisplayMode(Rhino.Display.DisplayModeDescription.GhostedId)

for k in range(10):
    obj1 = rs.AddSphere([k,0,0],.5)
    rhinoObject = rs.coercerhinoobject(obj1)

Perfect, thanks!