A method for attaching an object (3, 4) to a valve housing, the method comprising the steps of: - providing an opening (7, 12) in the valve housing, the opening (7, 12) defining an annular edge (8, 13) along a circumference of the opening (7, 12), - providing an object (3, 4) comprising an object body (5, 10) extending in a longitudinal direction, and an annular flange (6, 11) extending in a direction being substantially perpendicular to the longitudinal direction, the annular flange (6, 11) defining an outer circumference which is arranged at a distance from an outer surface of the object body (5, 10), along the direction being substantially perpendicular to the longitudinal direction, and defining a surface extending radially outwards from the outer surface of the object body (5, 10) towards the outer circumference, - mounting the object (3, 4) in the opening (7, 12) of the valve housing with the annular flange (6, 11) in abutment with the annular edge (8, 13), - attaching the object (3, 4) to the valve housing by performing welding of the annular edge (8, 13) and the annular flange (6, 11) by - directing a welding beam at least partly onto the surface defined by the annular flange (6, 11), in a region defined by an abutment region (15, 17) between the object body (5, 10) of the object (3, 4) mounted in the opening (7, 12) and an annular wall of the opening (7, 12), the welding beam being directed at an angle with respect to the longitudinal direction, the angle being between 0 degrees and 15 degrees, and - displacing the welding beam along the surface defined by the annular flange (6, 11), while maintaining the angle between the welding beam and the longitudinal direction. - providing an opening (7, 12) in the valve housing, the opening (7, 12) defining an annular edge (8, 13) along a circumference of the opening (7, 12), - providing an object (3, 4) comprising an object body (5, 10) extending in a longitudinal direction, and an annular flange (6, 11) extending in a direction being substantially perpendicular to the longitudinal direction, the annular flange (6, 11) defining an outer circumference which is arranged at a distance from an outer surface of the object body (5, 10), along the direction being substantially perpendicular to the longitudinal direction, and defining a surface extending radially outwards from the outer surface of the object body (5, 10) towards the outer circumference, - mounting the object (3, 4) in the opening (7, 12) of the valve housing with the annular flange (6, 11) in abutment with the annular edge (8, 13), - attaching the object (3, 4) to the valve housing by performing welding of the annular edge (8, 13) and the annular flange (6, 11) by - directing a welding beam at least partly onto the surface defined by the annular flange (6, 11), in a region defined by an abutment region (15, 17) between the object body (5, 10) of the object (3, 4) mounted in the opening (7, 12) and an annular wall of the opening (7, 12), the welding beam being directed at an angle with respect to the longitudinal direction, the angle being between 0 degrees and 15 degrees, and - displacing the welding beam along the surface defined by the annular flange (6, 11), while maintaining the angle between the welding beam and the longitudinal direction.