Where to put the python script


I am looking at some videos where python is used to create buttons and other things, but where is the script saved? The video is showing the code, but not where to put it.

I tried to put in a new component, but that does not work.

Thanks for helping!

There are few different ways to use Python scripting in VC, but I guess you mean the Python commands.
Those are add-ons to the VC program itself, not part of a simulation layout.

See this tutorial.

Thank you for your answer!

I have seen the video you are refering to, though it is not intuitive to know what to search for and find the add-ons I am looking for, or to know that there is an add-on for what I am looking for.

You say that “There are few different ways to use Python scripting in VC”, I am wondering what ways?

In the video I am reffering to (Python API in Visual Components 2014 vs 4.0 | Visual Components Academy (11:22)), he is creating input-field and buttons, and I am wondering where he is saving the scrip and does he run the script?

Best Regards

Python commands, Python script behavior, Python feature, Python process handler behavior and maybe some others.

The video shows creating a simple Python command, notice “from vcCommand import *” at the top instead of e.g. “from vcScript import *”.

Python commands you need to place under that “My Commands” folder like my linked tutorial explains.

Scroll down in that webinar page to find a button labeled “Download Files”

Here is the link to that button to get the zip with the commands shown in the webinar.

Thank you!

I opened the file and I got this error. Do you know why I am getting this error?

Best Regards

Thank you!

What is the difference between the different python-ways?

I tried to use “from vcCommand import *” i my python code, but I got an error. Do you know why? How to I know what is legal to use where?

Best Regards

You don’t and can’t develop the Python commands within the VC software itself but using some external editor. The simplest one is of course just Windows Notepad, but e.g. Visual Studio Code is actually pretty good free tool for Python development.

Like I said, the commands are extensions to the application itself, while the other types are part of a simulation component.