Louis was only nine when he stamped a treaty of alliance between his father and John of Bohemia. A year later, Louis accompanied his father in invading Austria. On 1 March 1338, John of Bohemia's son and heir, Charles, Margrave of Moravia, signed a new treaty with Charles I of Hungary and Louis in Visegrád. According to the treaty, Charles of Moravia acknowledged the right of Charles I's sons to succeed their maternal uncle, Casimir III of Poland, if Casimir died without a male issue. Louis also pledged that he would marry the margrave's three-year-old daughter, Margaret.