question

Andrew Jovaras avatar image
0 Likes"
Andrew Jovaras asked Mischa Spelt commented

Binding Flexsim to multiple Python modules

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.

FlexSim 22.2.0
python
1661238832737.png (65.4 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·
@Andrew Jovaras , have you tried it with a different name then “add” or with more other called python functions?
0 Likes 0 ·

1 Answer

·
Andrew Jovaras avatar image
3 Likes"
Andrew Jovaras answered Mischa Spelt commented

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

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image Mischa Spelt commented ·

:-) Or

from Summing import add
2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.