Getting input to psychopy from a Python script which performs animal tracking

It depends what you mean by “communicate with psychopy”. Running two scripts in parallel and having them communicate would be tricky. Is there any reason you can’t simply run your own Python script in PsychoPy and add stimulus presentation to it directly? If you need additional libraries that aren’t included in PsychoPy you can add them to the standalone install: Adding new python module to standalone psychopy

There’s also the option of making your script into a library and adding it to your standalone PsychoPy installation, which you could then import into a Python script, but that’s just a way of implementing what I describe above. It basically comes down to whether you can run your code in PsychoPy’s environment.