If you have repeated element instances in a sequence, when you do twiss(..., attach2elem=True), the twiss attached to that element is at the last point in the sequence.
So if you have the sequence (d_1, q_1, d_1, q_1, d_1), and then want to get the twiss at end of the first element by using attach2elem=True, then you will actually get the twiss at the end of the sequence altogether, which would be a surprise/wrong. This should somehow be dealt with properly, or warned when it happens, or whatever.
If you have repeated element instances in a sequence, when you do twiss(..., attach2elem=True), the twiss attached to that element is at the last point in the sequence.
So if you have the sequence
(d_1, q_1, d_1, q_1, d_1), and then want to get the twiss at end of the first element by usingattach2elem=True, then you will actually get the twiss at the end of the sequence altogether, which would be a surprise/wrong. This should somehow be dealt with properly, or warned when it happens, or whatever.