How to incorporate python script with VC

I have made a project on python. Now, I want it to run on Visual Components. My project is about Fulfillment Center. In this project operator makes an entry of an item which will update an inventory. Order can be placed by selecting options in a python script and sales can be seen in .csv file. So, I want to know how can I incorporate my python project and VC?

I’m going to ask the obvious question first. Do you have Pro or Premium? and as to the actual integration if you do have one of those versions it will depend on your code. Python Scripts to my knowledge can only be added inside of components. Once you add them, you will have to use the API to link things accordingly. Also as a side note make sure your project is in Python 2.7 I believe that is what VC uses. However I may be mistaken.

I am using VC premium 4.2 and python 3.8.5. So, I have to make script for every component, use API and link them accordingly. I will try this.

Thanks!

Not entirely. If you made a code that acts as a PLC for example you could add the script to just that one component that acts as your signal HUB. But if your code has different functions for different elements then you may want to separate certain functions into certain components. It depends on what your code does and what it requires as inputs. But good luck!

Like mentioned above the scripts typically run as component scripts. And you can create one smart “controller” component that is orchestrating the layout. It really depends on your application what would be the best approach. You can also use python commands to use VC API. But python commands are not good option for on simulation time control. They would be great to e.g. read in some input data to the layout etc. Download one of the commands shared on this forum to see the basic structure of commands.

[find ready-made addons here]