How to set parameter direction for exchange item element?

I want to set exchange item direction as IN/OUT as specified. I tried to use exchange_item_element_object.get_java_object().setDirection(get_enum_literal(“http://www.polarsys.org/capella/core/information/” + capella_version(), “ParameterDirection”, “OUT”)). It doesn’t work.

Is there any workaround to address this need?

Do you have an error message ?

I just tested the following code and it worked for me:

eie = ExchangeItemElement()
direction = get_enum_literal("http://www.polarsys.org/capella/core/information/" + capella_version(), "ParameterDirection", "OUT")
eie.get_java_object().setDirection(direction)
print(eie.get_java_object().getDirection())

I tested it again without error messages. Though the print was OK, the ExchangeItemElement under the project browser does not change its parameter direction. To be exact, the newly created eie under an OPERATION exchange item is still set as IN after the above procedure.
After that, I used exchange_item.get_owned_elements().add(eie) to add this eie, but it seems the direction setting has not been saved in the project model.

I just checked the following code:

ei = ExchangeItem()
eie = ExchangeItemElement()
direction = get_enum_literal("http://www.polarsys.org/capella/core/information/" + capella_version(), "ParameterDirection", "OUT")
eie.get_java_object().setDirection(direction)
print(eie.get_java_object().getDirection())

ei.get_owned_elements().add(eie)

eie.get_java_object().setDirection(direction)
print(eie.get_java_object().getDirection())

And I seems to work. I checked the IFE example for ExchangeItemElement and I was not able to find an element for wich I could set the direction. I checked the documentation. The ExchangeItem must be of type OPERATION and the ExchangeItemElement of kind MEMBER in order to set the direction. You might ask in the main Capella forum for more details.