How to add a functional exchange in physical architecture?

Hello, Python4Capella

I created two physical functions and fop/fip for each function. Now I want to add a functional exchange to connect those two function port. I coded as below

fe = FunctionalExchange()
fe.set_target_port(pfip)
fe.set_source_port(pfop)

No functional exchange is visible in a PDFB with those two physical functions, as well as in semantic browser of function port.

I tried to add this functional exchange to pfip.get_incoming_functional_exchanges() list but the exception throwed out declared it UnmodifiableEList.

Could goodness give me a hint?

So indeed, your functional exchange is not created because it is not contained by any model element.
Usually, functional exchanges are stored under the common higher-level function of the 2 functions between which the exchange is created.
So when you find this function, the following code should work:
myUpperFunction.get_java_object().getOwnedFunctionalExchanges().add(fe.get_java_object())

Stephane Lacrampe
Obeo Canada

Thanks Stephane. It reminds me the Filters and Customization can unhide the functional exchanges in project browser.