I was looking at shillelagh whose description states (emphasis mine):
The wood of a club or quarterstaff you are holding is imbued with nature’s power… The spell ends if you cast it again or if you let go of the weapon.
And then looking at animate objects whose description states:
Each target animates and becomes a creature…
Shillelagh ends when you let go of the weapon (which is now a creature) and the rule on “Moving Around Other Creatures” states:
Whether a creature is a friend or an enemy, you can’t willingly end your move in its space.
In order to cast shillelagh then, you would need both of the following to be true:
You are holding the animated object.
You are not in the same space as the animated object.
One way I thought this might be possible is if you grappled the animated object, so that you are not in its space but arguably holding (not wielding) it.
Does grappling an animated object let you cast shillelagh on it?