Attach a module to pins

for instance, I have a module and a footprint.

But I want to attach it to pins to the main board, like

pins

is there a way in Kicad add a pin footprint and tell Kicad that this module will be attached?
So in 3d view I will see this module is attached to the pins
thank you

You can add multiple 3D models to a footprint. In this case you may even consider to add 8 two pin header footprints. 4 male, and 4 female, but you will have to rotate and move each of the headers to make them fit.

Another option is to use FreeCAD or another 3D program to make a single step file that also has all the connectors.

That looks suspiciously like an MP1584. I created a KiCad project for this myself too. I wonder how many people have re-created PCB’s for these and other common modules (HX711, lm2596, ads1115, ads1118, Blue and Black pills, etc)

In such case I place at PCB separate pin-headers and separate my module (in my case it is RFID PCB antenna). Antenna footprint has 3D model located (floating) some distance over PCB so then it looks like being put on pin-headers.