I've never done this myself, but in theory, I guess you could have your external program write a JSON file, and then use Papyrus Utilities to read that file in game. Best of luck!
resetinventory in the console fixed this issue for me. Of course, you may want to empty out your follower first. But yeah, that console command solved the problem.
I came here after some lengthy googling, and this change instantly fixed it for me. Thanks! This did it for me, too. I had tried the player.kill, the coc qasmoke and pcb, and plain old removing mods -nothing worked but this. Thank you.