Application does not support just-in-time (JIT) error

If you’re just trying to run a Python script in Dynamo, then I don’t think Visual Studio has any part in this. Unless you’re building Dynamo itself from source and debugging from Visual Studio.

Assuming the pline object is a Dynamo polyline, then this code will fail because the object doesn’t have an ObjectId property. You need to unwrap it first to get to the DatabaseServices object.

This code was likely written back when the Python implementation used by the Dynamo team was IronPython, which supported brackets for indexing (for example bt[BlockTableRecord.ModelSpace]). Dynamo now uses Python.NET, which handles virtual indexers differently.