I prefer to have a textbook to work through if I'm self studying. I want a sense of units finished, progress made, and I want it to be quantifiable as a course. Like, I choose the test I want to pass and get the official book for that, work through the material (supplementing with online resources) and then take the test when I'm done.
I also made an office space I really enjoy being in, and I almost never let myself just be at leisure in there. If I want to hang in the warm, cozy room, I'm going to be studying or producing something.
I'm a teacher as well as a student, and while homework is something I dread, I absolutely recognize how it challenges me to demonstrate that I really have absorbed the content. Sometimes I give myself extra homework if I realize I'm struggling to retain a concept. I'm just going to keep doing that one thing until it's natural.