Preheat the oven to 200C/390F. Sift the flour into a large bowl and rub in the margarine until the mixture resembles fine breadcrumbs. Stir in 3-4 tablespoons water to form a firm dough. Wrap in plastic film and chill until ready to use.
Meanwhile, heat the oil in a large pan and fry the onions over a low heat for 15 minutes stirring occasionally until golden and softened. Stir in the apples, chestnuts, herbs and seasoning.
Roll out two-thirds of the pastry on a lightly floured surface and use to a line a 5 centimeter / 2 inch deep, 20 centimeter / 8 inch loose bottomed, fluted flan tin. Spoon in the chestnut mixture.
Roll out the remaining pastry and use to cover the pie filling, sealing the edges with a little water. Brush the surface with a little water and sprinkle with the sesame seeds.
Bake for 50-55 minutes until golden brown. Serve hot with a selection of vegetables and a red wine jus (fry finely chopped shallot in 25 grams / 2 tablespoons margarine for 2 minutes, add 300 milliliters / 1 1/4 cups red wine and boil until reduced by three quarters, add 300 milliliters / 1 1/2 cups vegetable stock and boil until reduced by half, whisk in 15 grams / 1 tablespoon margarine until glossy, season with freshly ground black pepper).