# quantlib: add handle to iborindex

I think this might be a very trivial question, but since I am pretty unfamiliar with C, this is a bit of a problem for me.

I have created IborIndex somewhere (it is correctly working):

mspr = ql.IborIndex('Mosprime', ql.Period('3M'), 2, ql.RUBCurrency(), ql.Russia(), ql.Following,  True, ql.ActualActual()


Later I want to use it for cap pricing. I create some working yield curve handle:

curve_handle = ql.YieldTermStructureHandle(mosprime3M.curve)


How do I pass it to the IborIndex? My solution is to recreate ql.IborIndex from scratch, using extracted parameters ( like mspr.familyName() ), but I believe there does exist a one-liner. Usual Python notation doesn't seem to work. Could you please help?

Pass a ql.RelinkableYieldTermStructureHandle to the index constructor and then link a curve to it...

curve_handle = ql.RelinkableYieldTermStructureHandle()
mspr = ql.IborIndex(
'Mosprime', ql.Period('3M'), 2, ql.RUBCurrency(), ql.Russia(),
ql.Following,  True, ql.ActualActual(),
curve_handle)

crv = ql.FlatForward(2, ql.Russia(), 0.01, ql.ActualActual())

new_index = mspr.clone(curve_handle)