There are no other ways to learn encode thoughts, and nothing short of a wish spell can allow you to cast encode thoughts without already knowing the cantrip.
The feats Spell Sniper and Magic Initiate, as well as the class features Pact of the Tome and Magical Secrets, and the All-Purpose Tool magic item, all specify that the selected spell comes from a class’s list.
Pact of the Tome:
choose three cantrips from any class’s spell list
Choose two spells from any classes
Choose a class: bard, cleric, druid, sorcerer, warlock, or wizard. You learn two cantrips of your choice from that class's spell list.
You learn one cantrip that requires an attack roll. Choose the cantrip from the bard, cleric, druid, sorcerer, warlock, or wizard spell list.
As an action, you can focus on the tool to channel your creative forces. Choose a cantrip that you don't know from any class list. For 8 hours, you can cast that cantrip, and it counts as an artificer cantrip for you.
Encode thoughts doesn’t appear on any class list.
Additional details: Encode thoughts cannot be stored in the magic item Spell Gem:
A spell gem can contain one spell from any class’s spell list.
An encode thoughts spell scroll would be unintelligible to everyone:
If the spell is on your class’s spell list, you can read the scroll and cast its spell without providing any material components. Otherwise, the scroll is unintelligible.
Other potential sources of cantrips that specify a class list: all other class features, aberrant dragon mark feat.
What about the Thief Rogue’s Use Magic Device and the Artificer’s Magic Item Savant with an encode thoughts spell scroll?
Both of these abilities say:
You ignore all class, race, and level requirements on the [use of magic items]
I argue that it still doesn’t work. These abilities let you ignore all class requirements. Trouble is, there are no class requirement to ignore. These two class features assume that there is some class based restriction we are ignoring that would normally be satisfied by having a particular class. Because there is no class that allows for casting encode thoughts, there is no proper class requirement to ignore with these class features. Rather, we observe that encode thoughts has a de facto character backstory requirement, something the Rogue and Artificer's abilities do not permit us to ignore.
Tasha’s contains a single-use method.
The release of Tasha’s Cauldron of Everything gives us a single-use magic item that can technically hold encode thoughts, the Spellwrought Tattoo:
Produced by a special needle, this magic tattoo contains a single spell of up to 5th level, wrought on your skin by a magic needle. To use the tattoo, you must hold the needle against your skin and speak the command word. The needle turns into ink that becomes the tattoo, which appears on the skin in whatever design you like. Once the tattoo is there, you can cast its spell, requiring no material components. The tattoo glows faintly while you cast the spell and for the spell’s duration. Once the spell ends, the tattoo vanishes from your skin.
So you can’t learn it still, but there is a way to cast it now without wish. That said, magic item acquisition is largely out of the control of the players, so you can still only cast encode thoughts if the DM wants you to cast encode thoughts.