Sending Messages Between Pages in Perspective

I was trying to do the same. So, now I'm looking for a way to get the pageID of the unborn page.

I think that I can locate the new page by using this code:

Then if page_id == self.page.props.pageId: should do the trick. But, If that's true, why not use self.page.props.pageId directly?

Edit #1:
I tested using a delay but now I know that it's using the old pageID.

from threading import Timer
	
	page = "/newtestpage"
	system.perspective.navigate(page)
	
	
	def runThisLater(param):
		payload = {"test": True}
		scope = "page"
		message = "newStatus"
		system.perspective.sendMessage(message, payload , scope)
	 
	# Call invokeLater with a 3000ms delay. Note that our function will not run immediately
	# because invokeLater always executes once the rest of this script is complete.
	Timer(1.0, runThisLater, ["Stop Waiting, I'm done"]).start()