code: func (v *Vars) checkVarsAccess(th *starlark.Thread, id ID) error {
  	switch {
  	case interpreter.GetThreadKind(th) != interpreter.ThreadExecing:
  		return fmt.Errorf("only code that is being exec'ed is allowed to get or set variables")
  	case len(v.scopes) == 0:
  		return fmt.Errorf("not inside an exec scope") // shouldn't be possible
  	case id >= v.next:
  		return fmt.Errorf("unknown variable") // shouldn't be possible
  	default:
  		return nil
  	}
  }
docs: // checkVarsAccess verifies the variable is being used in an allowed context.