Qiskit: total number of parameters after composing parametrized circuits

I'm trying to use the .compose() method to join two parametrized circuits, specifically TwoLocal instances from the qiskit.circuit.library.

While I would expect that .num_parameters_settable() would be the sum of the parameters in each circuit, the final circuit will have only as many settable parameters as only one of them.

Version: qiskit-0.26.2

Thank you very much for your help!

My code is:

from qiskit.circuit.library import TwoLocal
import numpy as np

rot = TwoLocal(
int(np.sum(num_qubits)),
"ry",
[],
reps=1,
skip_final_rotation_layer=True,
parameter_prefix="p",
)

var = TwoLocal(
int(np.sum(num_qubits)),
"ry",
"cx",
entanglement="linear",
reps=1,
skip_final_rotation_layer=True,
)
rot.num_parameters_settable()
>> 2
rot.compose(var, inplace=True)
rot.num_parameters_settable()
>> 2


Looking at the documentation for TwoLocal, you can see that .num_parameters_settable refers to the number of parameters originally available in the circuit.
However, .num_parameters will give you what you are looking for. I tried it with your code setting num_qubits=2 and it indeed works as you want. This property is defined as:
Meaning that it actually updates when an action like .compose() is made on the circuit.