Take an otherwise uninteresting object, and have the other characters (or at least one character) interact with it as if it is a real character, and you have a Companion Cube. Sometimes, the object blurs the line between real and imaginary by apparently doing things which would be hard for an inanimate object to do or telling people things they shouldn't have been able to already know, but the defining characteristic is that we the audience never, ever see it move of its own volition on camera, even if it clearly must've done something.
For some reason, Companion Cubes tend to become very popular with the audience. Something to do with the Uncanny Valley, probably. Or simply because the idea of having an inanimate object being a character is funny. Or maybe because it's easy to project the best traits you can think of onto the object. Or because you can make yourself a replica at home...
Dolls and stuffed animals, especially teddy bears, are common examples, probably because they're humanoid, friendly looking, and meant to be bonded with. Typically the owner will treat it as their Confidant. Security Blankets are also common in this regard. This can be used to reinforce a character's childlike innocence (if they're meant to be sympathetic) or make them look dangerously immature (if otherwise). Beware if they start Consulting Mister Puppet!
If a character gives a weapon this treatment, expect it to have a name.
This can go wrong in fandom. Horribly, horribly wrong.
As a frightening and interesting aside, it has been demonstrated in US Army experiments that people kept in isolation have a tendency to form attachments to inanimate objects (this is why this tends to show up in Speculative Fiction a lot, where the crew personifies their starships and other objects). Sweet dreams!
If an inanimate object does move onscreen, it slides from this trope to Through the Eyes of Madness or Magic Realism in general. (Unless it's designed to move independently, like a Roomba or something.)
The opposite is Living Toys. Also contrast Enmity with an Object (aka "Cargo Nemesis"). If an animal or a robot interacts with an object in a romantic way, that's Animal Sweet on Object. A subtrope of this is Companion Food, when the object in question is food.