Grind the walnuts if you have them whole. Place ground nuts in a bowl, add the flour, powdered sugar, cocoa powder, and chopped butter.
Work into a smooth dough, wrap in food wrap and leave to rest in the fridge for at least two hours.
Meanwhile, prepare the molds: grease each with a bit of butter or other fat and dust with flour. Knock off any excess flour.
Take the nut dough out of the fridge and let it sit on the kitchen counter for about 15 minutes. Scoop out equally sized pieces, pressing each into the prepared mold. Press the dough in the center slightly with your thumb to create a well. This is where the filling comes.
Place the filled molds on a baking sheet and bake them in the oven preheated to 340 °F (170 °C) for 10 minutes.
Allow the baked cookies to almost cool, then gently tap each mold side down on the work surface; the cookie should fall out easily.
Prepare the buttercream for the filling: beat the softened butter with the powdered sugar, add the finely ground nuts and rum.
Fill the cookies with buttercream. You need a round knife or two teaspoons. Finally, cover the filled part with the other cookie.