Start modules with a script
Continue from Your first RPC by putting the two manual startup commands, rpcSubscriber and rpcPublisher, in a script. Vinc will start the modules in order.
Reuse the built open-vinc-examples project from the previous lesson. Run all PowerShell commands below from the repository root, where you can see scripts/ and build/.
1. Prepare the startup script
Section titled “1. Prepare the startup script”The example includes scripts/rpc-startup.tcl:
# Start the receiver before the sender.rpcSubscriberrpcPublisherscripts/rpc-startup.tcl · e165aed
The line beginning with # is a comment. The next two lines are the same ModuleTypes you entered in Vinc Shell.
The central application’s Vinc Shell runs the Tcl script. C++ and Python modules use the same file. The example build already includes the required Tcl runtime.
Commands run in order: wait for rpcSubscriber to start and reach Ready, then start rpcPublisher. Both modules keep running after the script finishes.
2. Run the script when starting Vinc
Section titled “2. Run the script when starting Vinc”If the previous Vinc Shell is still open, enter exit first. Back in PowerShell, run:
.\build\debug\Vinc.exe -S scripts/rpc-startup.tcl.\build\python\Vinc.exe --python .\.venv\Scripts\python.exe -S scripts/rpc-startup.tcl-S selects the script to run at startup. Put Python’s --python option before -S.
The script path is relative to the current working directory, which is why you run this from the repository root. Editing only the .tcl file does not require rebuilding the modules.
You will see startup output from both modules. Wait for:
Script completed: scripts/rpc-startup.tclThis means the script finished successfully. You can now enter commands in Vinc Shell; both modules have already been created.
3. Check that the modules are ready
Section titled “3. Check that the modules are ready”Query the received count:
sender countWait for the sender to print:
RPC received=0Send a message:
sender sendWait for the receiver to print:
received sequence=1 publisher=senderEnter sender count again to get RPC received=1. The operations are the same as the previous lesson; the script handles module startup.
4. Use srun from an open Shell
Section titled “4. Use srun from an open Shell”You can also open Vinc first, then run the same file. Enter exit to close the previous central application. Back in PowerShell, launch without -S:
.\build\debug\Vinc.exe.\build\python\Vinc.exe --python .\.venv\Scripts\python.exeOnce you see VINC ready, enter in Vinc Shell:
srun scripts/rpc-startup.tclAgain, wait for Script completed: scripts/rpc-startup.tcl. Enter sender count; the newly started receiver replies with RPC received=0.
Use -S to run a script when Vinc starts, or srun to run one from an open Shell.
This example uses fixed instance names, sender and receiver. Running the same startup script again while those modules are running fails because the names are already in use.
5. Shut down cleanly
Section titled “5. Shut down cleanly”exitWait for stopped sender, stopped receiver, and a return to PowerShell. Finishing a script leaves the modules running; the Shell’s exit command requests normal shutdown.
No Script completed message?
Check the PowerShell working directory and script path first. If a script command fails, the error reports its file and line, and that script run stops.
Modules that already started keep running. The script does not automatically undo earlier actions. Enter exit to close normally, fix the script, then start again.
Next step
Section titled “Next step”Continue with Write logs from your modules to record module activity and choose which levels appear in the Shell.