groovy.lang.MissingPropertyException: No such property: jenkins for class: groovy.lang.Binding
As pointed out by @Jayan in another post, the solution was to do the following
import jenkins.model.*
jenkins = Jenkins.instance
Then I was able to do the rest of my scripting the way it was.
Please double check that jenkins is not blocking this import. Go to script approvals and check to see if it is blocking it. If it is click allow.
https://jenkins.io/doc/book/managing/script-approval/