Thanks guys!
According to this false bug-report https://forum.renoise.com/t/auto-capture-instrument/29561 the Ledgers AutoCaptureFromFirstNote script was preventing the capture_nearest_instrument_from_pattern method to take effect. - And that’s why I was so confused in the first place.
But I got it now. Hmm… That makes things a bit bit more complicated for me. Would be great if there was a method to just get the nearest instrument index from anywhere you want and not depending on where’s the cursor at and not changing the selected instrument.