Yes, just store the parent node in a variable and call the add_child function on it. Most games will need only one CanvasLayer node for UI that can be shared across different UI elements.
I would also suggest creating a script and saving your main UI CanvasLayer as a separate scene at some point when your UI logic is becoming too complex. Just as all of your player logic is encapsulated into its scene with its own script, you should also have a universal UI overlay/HUD node that will encapsulate all logic related to the new UI packed scenes instantiation and freeing of nodes that are no longer in use. Then, you can connect signals or call this new main UI node from other scripts, like your DialogueManager. It’s not something that I would advise rushing to implement right away at this point, or even in your first several small games, but you’ll notice that at some point, for your game logic to scale more easily, some more complicated architecture may be needed.
It centers all child UI nodes in the rectangular area it defines. In the post above, I specified anchor points as L=0.5, T=0.8, R=0.5, and B=0.8. This is just a point that is 80% of the screen height from the top and, therefore, 20% from the bottom. Horizontally, it is 50% of the screen width. That’s not very useful as a container since both left/right and top/bottom anchors are the same. You can change them to something like L=0.25, T=0.5, R=0.75, B=1. Note that the values are fractions of the corresponding width/height of the screen, specifying the offset from the left side of the screen for the horizontal axis and offset from the top side of the screen for the vertical axis.
So now the CenterContainer has a width equal to R-L = 0.5
widths of the screen and center at (L+T)/2 = 0.5
of screen width.
The vertical axis will have B-T = 0.5
screen height centered at (B+T)/2 = 0.75
vertically.
You can see the frame in the editor corresponding to the area CenterContainer now takes. Now try adding a child to this CenterContainer. Let’s say a ColorRect node, for example. Set its Layout / Custom Minimum Size to some arbitrary value, like (40, 40) or something. You’ll see how the colored square is now centered in the area that CenterContainer is defining.
This approach will also scale perfectly for any screen size/ratio since we’ve used only relative ratios for anchors instead of relying on constant positions in px. Btw, anchors are not exclusive to the CenterContainer, they are a property of any Control node.
However, for complex UIs, I would personally avoid using anchors for everything, giving favor to specifying the layout with containers. This will require setting proper input propagation if you’ll need to click on anything under UI, but the benefits that come from containers are easily worth this extra step. Just as with the game architecture, Godot UIs are another skill that should gradually come with practice.
Good luck with your project 