Binding Flexsim to multiple Python modules

Binding Flexsim to multiple Python modules

andrew_jovaras11
Not applicable
671 Views
3 Replies
Message 1 of 4

Binding Flexsim to multiple Python modules

andrew_jovaras11
Not applicable

[ FlexSim 22.2.0 ]

Following on from this question, I've been looking at the functionality to connect Flexsim to Python. Connecting to a module directly works as expected, however I'm having trouble utilizing solutions which are spread over multiple files.

1661238832737.png
I've uploaded a test.fsm file which has two functions linked to python.
-user command "Add" calls module "Summing" directly, and adds inputs as expected.
-user command "CallAdd" calls module "FlexsimPy", which call the same function as above. An error is thrown as the model cannot find the required command.

It would appear that commands cannot be imported between modules in this way. My solution is spread across a number of files, I'm looking for a workaround to this that does not require merging these together.

0 Likes
Accepted solutions (1)
672 Views
3 Replies
Replies (3)
Message 2 of 4

joerg_vogel_HsH
Mentor
Mentor
@Andrew Jovaras , have you tried it with a different name then “add” or with more other called python functions?
0 Likes
Message 3 of 4

andrew_jovaras11
Not applicable
Accepted solution

Problem was a syntax error. When calling external module, should have prepended with module name (ie "Summing.add" instead of just "add")

Message 4 of 4

mischa_spelt
Advisor
Advisor

🙂 Or

from Summing import add