if nodeA.get_filename() == sceneA.get_path():
That should do it, calling
get_filename() on an instantiated scene's root node returns the path to the scene file by default.
If you want to check child nodes as well, use
get_owner(), which in effect returns the root node when called on child nodes or null otherwise:
root = nodeA.get_owner()
root = nodeA
if root.get_filename() == sceneA.get_path():