Essentially you are initializing pageutil twice.
It is best if all pages are added to the B4XPageManager in B4XMainPage.
Since there is only one instance of "pageutil", you need another way to "set" the message (other than "initialize"). See below.
'In MainPage
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
B4XPages.AddPage("pageutil",pageutil)
pageutil.initialize
page1.Initialize(pageutil)
page2.Initialize(pageutil)
B4XPages.AddPage("page1",page1)
B4XPages.AddPage("page2",page2)
End Sub
'in p1 and p2
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private pageutil As pgUtils
End Sub
Public Sub Initialize(pageUtils_ As pgUtils) As Object
pageutil = pageUtils_
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("ly_pg1")
End Sub
Private Sub Button1_Click
pageutil.Msg = "this is from page1"
B4XPages.ShowPage("pageutil")
End Sub
'In pageutil
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private PgMsg As String
End Sub
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("ly_util")
End Sub
Public Sub setMsg(msg As String)
PgMsg = msg
End Sub
Sub B4XPage_Appear
xui.MsgboxAsync(PgMsg, "B4X")
End Sub