How would I code a simple plugin like this?

I used a program awhile ago called anime studio, and it had a thing called switch layers that looked like this: https://gyazo.com/72f80094e49cae7279aa70834c3029c6 Basically I want to recreate that as a sort of feature in the outliner. This would help me and a lot of other people do 2D cutout animation in blender. Many thanks!

Have you tried this addon?

https://github.com/search?utf8=✓&q=blender+2d

Yeah, I have. Its difficult to use and install though, and doesn’t work with meshes.