# Python, get the package, namespace and key of an unreal.Text

**URL:** <https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234>\
**Category:** Editor Scripting\
**Tags:** unreal-engine, question\
**Created:** [August 17, 2023, 7:16pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234 "2023-08-17T19:16:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgauthier\_pdg](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pgauthier_pdg/32/1008648_2.png) [@pgauthier\_pdg](https://forums.unrealengine.com/u/pgauthier_pdg)\
**Post date:** [August 17, 2023, 7:16pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/1 "2023-08-17T19:16:01Z")

</div>

Hello,

I’m extracting dialog text for localisation and I can get the text line as an unreal.Text object.  
However, I can’t find a way to get the package, namespace and key that I see when hovering the text in the editor.

Is this something that I can do in python?

Regards,  
Pierre

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [August 18, 2023, 12:55am UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/2 "2023-08-18T00:55:49Z")

</div>

[https://docs.unrealengine.com/4.27/en-US/PythonAPI/class/TextLibrary.html](https://docs.unrealengine.com/4.27/en-US/PythonAPI/class/TextLibrary.html)

---

<div class="post-metadata">

**Author:** ![pgauthier\_pdg](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pgauthier_pdg/32/1008648_2.png) [@pgauthier\_pdg](https://forums.unrealengine.com/u/pgauthier_pdg)\
**Post date:** [August 18, 2023, 7:43pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/3 "2023-08-18T19:43:16Z")

</div>

Hello @AreWeGaming!

Thank you for the suggestion.

I gave a try to TextLibrary.  
The only useful method I see there is string\_table\_id\_and\_key\_from\_text and this is returning None when I supply my text object in parameter.

Help on my text object returns this: class Text(\_WrapperBase)…

And if I call find\_text\_in\_localization\_table using the Key that I see in the editor, it is returning my text.

I just need a way to get the key from my Text.

Regards,  
Pierre

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [August 18, 2023, 8:19pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/4 "2023-08-18T20:19:47Z")

</div>

> [@How to show Input Key in Text / String](https://forums.unrealengine.com/t/how-to-show-input-key-in-text-string/311358):
>
> I want to show “Press E to interact” as a text, but instead of the “E” I want to display the actual mapped button for that specific input. How do I create a text or string like that?

---

<div class="post-metadata">

**Author:** ![pgauthier\_pdg](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pgauthier_pdg/32/1008648_2.png) [@pgauthier\_pdg](https://forums.unrealengine.com/u/pgauthier_pdg)\
**Post date:** [August 21, 2023, 3:37pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/5 "2023-08-21T15:37:40Z")

</div>

This is not related to what I’m looking for.

What I need is this key:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/4/574136dd44c8e2291570be9c5c59818da18603e6.png)

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [August 22, 2023, 12:07pm UTC](https://forums.unrealengine.com/t/python-get-the-package-namespace-and-key-of-an-unreal-text/1264234/6 "2023-08-22T12:07:24Z")

</div>

> **[Find String Table ID and Key from Text](https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/Text/FindStringTableIDandKeyfromText/)**
>
> Find String Table ID and Key from Text

> [@Creating/setting unique id for text? \[Localization\]](https://forums.unrealengine.com/t/creating-setting-unique-id-for-text-localization/407483):
>
> We have around 2000 strings and we’ve managed to translate them all already. However I cannot find any ids that are unique(Think it’s called namespace in the editor) for every string and I saw the they are all empty. Is there way to create or set string IDs (Namespaces) for all the localizable strings automatically? Or will there be any problems/side effect if I just put namespace in the place?
