AWRDE is a COM automation server and any programming language that can perform as a COM client can be used. This includes Python. With Python you will need to install the win32com.client library.
Why use Python with AWR
By far the most common question we get regarding Python is when to use Python vs. Visual Basic. Each language has advantages and disadvantages and while most scripting tasks can be performed in either, some tasks are much easier in one vs the other.
When to use Visual Basic
- You already know VB and don't know Python
- You don't know any language and what to use whatever is easiest
- Your script will need a form or other UI to interact with the user
- You want to call your script from a menu or toolbar in MWO
- You want to save your script in your project file so other users can run it
When to use Python
- You know Python and don't want to learn Visual Basic
- You need to use libraries that only run in Python
- You want to create scripts that run from a command line
- You want to do analysis in a Jupyter notebook
If you decide to use Python this page will help get you setup.
Installing win32com (pypiwin32)
First, in the AWR Design Environment, you need to go into the VB scripting and run
to get the CLSID of the instance you want to connect to. This will be something like:
Then, from within python, you use: