Preheat the oven to 400°F (200°C) and line a baking sheet with parchment paper.
In a large mixing bowl, combine the chopped spinach, feta cheese, ricotta cheese, green onions, garlic, dill, salt, and black pepper. Mix well until all ingredients are evenly incorporated.
On a lightly floured surface, roll out one sheet of puff pastry to smooth out creases. Cut the pastry into squares, approximately 4 inches by 4 inches.
Place a tablespoon of the spinach and cheese mixture in the center of each square. Fold the pastry over to form a triangle and press the edges together to seal. Use a fork to crimp the edges for a decorative touch.
If using, brush the tops of the triangles with the beaten egg for a golden finish. Sprinkle sesame seeds on top if desired.
Arrange the triangles on the prepared baking sheet and bake for 20-25 minutes, or until golden brown and puffed.
Allow to cool slightly before serving.