Triggering Python program using an Arduino - spectrometer

Hello,

Please bear with me, I am an absolute beginner and hope to get some help by this awesome community. I am also not a native speaker so please excuse my englisch.

I am building a spectrometer based on a linear CCD Sensor TCD1304. I followed the guide by Esben Rossel: Linear CCD module | Hackaday.io

I am also using his Software to drive the CCD sensor: https://tcd1304.wordpress.com/

I am using the Nucleo F401 as a microcontroller.

Here you can find the software for the user interface and the firmware for the Nucleo F401RE: pyCCDGUI | TCD1304.wordpress

I got everything to work, and I am able to record a spectrum.

Now my problem: I want to time the collection of the spectrum by using an Arduino and I want to implement the possibility of a delay. For example: If light hits a photodiode, the Arduino triggers the collection of the spectrum by the software. I also want to be able to implement a delay for this trigger signal. So that the spectrum is collected 20ms (for example) after the photodiode is hit by the light.

I got the suggestion to use a client-server connection to trigger the collection of the spectrum.

Does anybody of you have an idea how to implement this function into the software? I'm in way over my head and would love to get some tips from you.

Thanks a lot!

Why not connect the photodiode to an input on the Nucleo, to make a self-contained system?

Never thought about that to be honest... but it definitely sounds like the better idea.
My main problem is, that I have no idea how to implement that feature into the software.