Heat the oven to 200C/400F/Gas 6.
Roll out the pastry and cut out circles 20cm/8in in diameter.
Heat the oil and cook the onions in it until starting to soften.
Take off the heat and cool. Stir in the grated cheese and season well.
Divide the mixture between the 6 circles and crimp the edges together. Brush with a little of the beaten egg.
Put on a baking sheet and bake in the oven for 20-30 minutes until the pastry is golden. Serve hot or cold.