Ideas
My Sim moved into a university dorm while the rest of their household stayed at home. Somehow, the llama ended up in my active Sim’s inventory, and I couldn’t interact with it directly there.
I visited the home lot of the original household and tried to assign the llama to the existing llama house, but the interaction was greyed out and unresponsive. So, I used bb.enablefreebuild to delete the old llama house and placed a new one. At that point, I was finally able to assign the llama to the new house.
However, when I returned to the university dorm, the llama followed me back and showed up in my inventory again.
If I deleted the llama house after assigning the llama (while still at the original lot), the llama disappeared completely — possibly permanently. That could be useful if someone wanted to remove it, but in my case, I wanted the llama to stay with the household and be there when my Sim returns from university.
As a workaround, I placed a llama house in the dorm and assigned the llama to it. Then I added another Sim to the household using Shift+Click (the game wouldn't allow the action otherwise, if the Sim is not a roommate). This newly added NPC Sim took the llama into their inventory after a while. I then deleted the llama house, moved that NPC Sim to the original home lot using "Manage Worlds," placed the llama into a new llama house there, and finally removed the NPC from the family. The llama successfully remained at the original home.
This is a complicated and unintuitive workaround, but it worked. It seems the llama system isn’t properly designed for split households with university dorms.