James VI and I, not IV and I.
Oops! - yes, thanks.
James IV was about a century earlier, and "only" the King of Scotland. But it was his artfully negotiated marriage to Margaret Tudor that set the dynastic stage - for his great grandson (James VI and I) to also inherit the thrones of England and Ireland in the Union of the Crowns.