Get layer of an object with rs.ObjectLayer(x) inside Python compnent

FYI:
https://www.google.com/search?q=scriptcontext+python+doc

http://developer.rhino3d.com/api/RhinoCommonWin/html/T_Rhino_RhinoDoc.htm

WARNING!! Do not use the ActiveDoc if you don’t have to. Under Mac Rhino the ActiveDoc can change while a command is running. Use the doc that is passed to you in your RunCommand function or continue to use the same doc after the first call to ActiveDoc.

This is a very succinct tutorial on the practical use of GhPython:
TIPS | SCRIPT CONTEXT IN GH PYTHON

Of the languages I mentioned, I was deeply immersed in Pascal, Java, PHP and Javascript and barely dipped my toe in Python, on one project based on the Django web framework. I was stunned and appalled at the use of indentation alone instead of “{}” curly brackets to indicate code blocks! One of the dumbest “enhancements” I’ve ever seen in the long history of programming languages.

I have not delved deeply enough into Rhino/GH scripting to understand this scriptcontext.doc issue but I can recognize a hazardous abstraction when I see one. If I ever do decide to get serious about Rhino/GH “scripting”, I’ll remember your advice about C# and look into it. Perhaps I missed something good there. I’ll never touch VB Script on general principles and would prefer to use JavaScript if I could.

Cheers