How to send target point to avoidance node using script

I’m trying to make the drone fly to a certain point (without collision) without using QGroundController but using a script.
I’m trying to test this in simulation first…
I do not have a solid understanding about what I should do but I tried to use MavSDK and it run with Gazebo only, when I tried to run the avoidance node then run the MavSDK script it couldn’t connect to the drone.
If anyone has a better insight about what is the way to do that, please tell me.