Section 29. If, after a divorce has been adjudged in another jurisdiction, minor children of the marriage are inhabitants of, or residents in this commonwealth, the probate court for the county in which said minors or any of them are inhabitants or residents, upon an action of either parent or of a next friend in behalf of the children, after notice to both parents, shall have the same power to make judgments relative to their care, custody, education and maintenance, and to revise and alter such judgments or make new judgments, as if the divorce had been adjudged in this commonwealth.