# I am working on Root file and it has Tdirectory and Tmap object. I am not able to work with Tmap object. I am working with root file using python not c++.please help me

**URL:** <https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [April 10, 2025, 12:53pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349 "2025-04-10T12:53:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asifulla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/7ea924/32.png) [@asifulla](https://root-forum.cern.ch/u/asifulla)\
**Post date:** [April 10, 2025, 12:53pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/1 "2025-04-10T12:53:59Z")

</div>

I am working on Root file and it has Tdirectory and Tmap object. I am not able to work with Tmap object. I am working with root file using python not c++.please help me

---

<div class="post-metadata">

**Author:** ![silverweed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/silverweed/32/36670_2.png) [@silverweed](https://root-forum.cern.ch/u/silverweed)\
**Post date:** [April 10, 2025, 1:19pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/2 "2025-04-10T13:19:44Z")

</div>

Hello @asifulla, welcome to the Forum.  
I invite you to read the [Introductory manual section](https://root.cern/manual/root_files/#reading-an-object-from-a-root-file) about TFiles to learn how to use ROOT. It has examples both for C++ and Python and it should get you up to speed quickly.

Roughly speaking it sounds like you want to retrieve your TMap object from the ROOT file, which is done like this:

```python
with ROOT.TFile.Open("myFile.root") as file:
  myMap = file.Get("nameOfMapObject")
  # `myMap` now contains the TMap object

```

---

<div class="post-metadata">

**Author:** ![asifulla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/7ea924/32.png) [@asifulla](https://root-forum.cern.ch/u/asifulla)\
**Post date:** [April 10, 2025, 1:28pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/3 "2025-04-10T13:28:05Z")

</div>

can we connect please @silverweed

---

<div class="post-metadata">

**Author:** ![asifulla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/7ea924/32.png) [@asifulla](https://root-forum.cern.ch/u/asifulla)\
**Post date:** [April 10, 2025, 1:34pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/4 "2025-04-10T13:34:30Z")

</div>

this code is not working with my file.  
My file has Tdirectory and Tmap object. I have dealt with Tdirectory but not able to work witg Tmap

---

<div class="post-metadata">

**Author:** ![silverweed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/silverweed/32/36670_2.png) [@silverweed](https://root-forum.cern.ch/u/silverweed)\
**Post date:** [April 10, 2025, 1:53pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/5 "2025-04-10T13:53:18Z")

</div>

Sorry but it’s a bit hard to help with so little context. Could you be a bit more specific in what are you trying to do, what you tried and how it is not working?  
If you have some specific code that is behaving unexpectedly, could you post it?  
Otherwise, if it’s a more conceptual problem, please try to formulate it in more detail.

---

<div class="post-metadata">

**Author:** ![asifulla](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/7ea924/32.png) [@asifulla](https://root-forum.cern.ch/u/asifulla)\
**Post date:** [April 10, 2025, 1:55pm UTC](https://root-forum.cern.ch/t/i-am-working-on-root-file-and-it-has-tdirectory-and-tmap-object-i-am-not-able-to-work-with-tmap-object-i-am-working-with-root-file-using-python-not-c-please-help-me/63349/6 "2025-04-10T13:55:01Z")

</div>

can you provide me your email adress
