Dbus is a daemon on linux systems that allows applications to talk to one another via external methods. The internals can be pretty detailed,but it is quite easy to learn it well enough to talk to applications via simple scripts.
Pretty much every language has a mature, well maintained library to do this, including C, Java, Go and Python.
A lot of times I just want to call a method in another application. This is very easy just from a shell script, here is an example:
This is a library that I have used for java:
In Go a well featured library is here:
Below is an example in go of how to use this library to talk to Spotify, call methods, and get information about the current song: