The code with the layout is going to send your shape into top-level zones, which is apparently not what you're looking for. Please check that the content template that you are using (typically content.cshtml or some alternate of that, in your theme) does
have a Header local zone defined.

Then again, I'm confused: you are saying "it disappears or it is only visible in the content zone". Which is it? And isn't it what you want that it displays in the Header local zone under the top-level Content zone? That's what seems to be implied as when
it displays in the header when you user the Layout code above, you do not seem to be satisfied either. Can you please detail what exactly you are trying to obtain?

That last code you have is a perfectly valid way of doing things. The reason why the code above that was not rendering is that "shape" there is actually not a shape, it's a shape result. You would have needed to extract the shape out of it. But your
last code is just fine. You can even pass in data by adding parameters: New.Parts_TestHeader(Foo: "bar").