Still able to hide objects with python?

I see there was some changes ,but we now have no way of hiding objects with python anymore.

https://developer.blender.org/rB897e047374fa3d3ceef35aa2cdb3372b6a7cc64a

the linked article is pretty old, since then a lot of work has been done on the Python API. use bpy.context.object.hide_viewport or bpy.context.object.hide_render to query the visibility, and bpy.context.object.hide_viewport = True or bpy.context.object.hide_render = True to set the flag.

1 Like

The option with “hide_viewport” got removed. Well, actually it still works ,but doesn’t show it in tooltip.

viewport_1

When you run code you get this.
viewport_2

There is a change in behavior of the buttons for Viewport and Instance visibility. When Alt-Clicking on the Eye Icon, the object should not show up in collection instances any longer. With todays build there is a refresh issue with this system (visibilities in Viewport are not refreshed according to those states), this makes it so confusing at the moment. Seems to be a WIP implementation at the moment.