Xplane, mavlink(pymavlink or mavsdk), px4 and Qgroundcontrol

i am trying to connect px4 and xplane in linux… there is a plugin called “xplane connect” which helps user to send command to xplane through python. And mavlink is the one that send data to px4… SO I HAVE TWO Questions … Is there any way to connect xplane to mavlink(pymavlink or mavsdk). so that data transfer between xplane and mavlink will happen. and how to connect px4 to xplane via UDP port to send and receive data?
(in simple, how to connect xplane, mavlink, and px4 all together) …
thanks you in advance.
(edit: i know that there is px4toxplane plugin is available. but i want to learn it from base… that why i didnt use that plugin and manually connecting it using socket python module …)