Line a large baking sheet with wax paper or parchment paper.
In a medium saucepan, combine the vegan margarine, soy milk, sugar, and cocoa powder.
Bring the mixture to a full, rolling boil over medium heat, stirring occasionally.
Once boiling, allow it to cook for exactly one minute without stirring. This step is crucial for the cookies to set properly.
Remove the saucepan from the heat. Immediately stir in the peanut butter and vanilla extract until the peanut butter is completely melted and the mixture is smooth.
Add the quick-cooking oats, chopped walnuts, and coconut flakes to the saucepan.
Stir until everything is well combined.
Working quickly, drop spoonfuls of the mixture (about 2-3 tablespoons / 45 ml / 1.5 fl oz each) onto the prepared baking sheet. Lightly press with the back of the spoon to form a cookie shape.
Place the baking sheet in the refrigerator and chill for at least 30 minutes, or until the cookies are firm.
Store in an airtight container in the refrigerator.