How to activate a layer with python

I am just now trying to play with a python script. I want to set the active layer through the script. Is is possible? How can I achieve that?

By activate, I meant the same behavior as clicking the layer with the mouse in the Layers List.
image

I don’t think there is an API for that. But if you are brave enough you can always have your script find the ui widget responsible and emulate a click on it. See this for example of such shenanigans:

1 Like

Yeah, thank you. I was trying to get something from this script before.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.