Preheat the oven to 180°C/160°C fan/gas 4. Grease a deep pie tin with butter, roll out one packet of pastry onto a clean, floured surface. Lay over the pie tin and press gently into the edges on the tin. Prick the base with a fork. Cover the pastry with a sheet of greaseproof paper and cover with rice or dried beans.
Bake for 10-15 minutes until pastry is a pale golden brown, remove from the oven, discard rice or beans and paper, set aside to cool.
Preheat the oven to 200°C/180°C fan/gas 6. For the filling, bring the potatoes to the boil in a saucepan. Reduce to a simmer and cook until the potatoes are tender enough to mash. Drain the potatoes and mash. Add onion, cheese, salt and pepper. Beat until cheese is well incorporated. Add the milk and chives and stir the mix well.
On a lightly floured surface, roll out the remaining pastry and cover the pie, push the pastry into the edge of the pie and trim any excess. Brush the pastry with the beaten egg and bake for 20-25 minutes, or until golden-brown. Let the pie stand for 15 minutes before cutting and serving