Line an 8-inch square baking pan with parchment paper, leaving some overhang for easy removal.
In a saucepan over low heat, melt the butter, sugar, and cocoa powder together until smooth.
Slowly whisk in the beaten egg, stirring constantly until the mixture thickens slightly, about 1 to 2 minutes.
Remove the saucepan from the heat.
Stir in the graham cracker crumbs, shredded coconut, and chopped walnuts or pecans.
Press the mixture firmly into the bottom of the prepared pan in an even layer.
Refrigerate the base for 20 minutes.
In a mixing bowl, beat the softened butter until smooth.
Add the powdered sugar, custard powder, milk or cream, and vanilla extract.
Beat until creamy and spreadable.
Spread the custard filling evenly over the chilled base.
Refrigerate for 45 minutes, or until the filling is firm.
Melt the chopped chocolate and butter together in a microwave-safe bowl in short intervals, stirring until smooth.
Pour the melted chocolate over the custard layer and spread evenly.
Refrigerate for 1 hour, or until fully set.
Let the bars sit at room temperature for 5 to 10 minutes before slicing.
Cut into 16 squares and serve chilled or slightly softened.