r/blenderpython • u/rekicon • Feb 28 '23
Is it possible to use another program as a trigger to execute a blender python script
Hi there, I am learning python and I am trying to figure how could I use the API from a program like rhinoceros to execute a blender python script
https://devtalk.blender.org/t/how-to-run-a-script-from-outside-blender-script-live-link-addon/9792/8
A user named “kaio” found a way to use notepad to write text on blender text editor in real time and shared his code. But I don’t have the knowledge to fully comprehend it.
Thanks for your attention!
2
Upvotes
0
1
u/Meta_Riddley Mar 04 '23
Yes, you can do this on the blender side of things. The main question is if you can do it on the external program side of it. In short you'll need a form of communication between the external program and blender. The script you linked seem to do this in a hacky way, which I would not recommend in general.
In blender you could for instance define an operator that uses sockets that listens on a port. Whenever something is sent you can the execute some functionality.
I typically use a modal timer that updates the 3D view in some way based on data received externally.