# Mgxs generation post process issue

**URL:** <https://openmc.discourse.group/t/mgxs-generation-post-process-issue/2486>\
**Category:** User Support\
**Created:** [November 17, 2022, 4:08pm UTC](https://openmc.discourse.group/t/mgxs-generation-post-process-issue/2486 "2022-11-17T16:08:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yohannes](https://avatars.discourse-cdn.com/v4/letter/y/bbce88/32.png) [@Yohannes](https://openmc.discourse.group/u/Yohannes)\
**Post date:** [November 17, 2022, 4:08pm UTC](https://openmc.discourse.group/t/mgxs-generation-post-process-issue/2486/1 "2022-11-17T16:08:39Z")

</div>

Dear support team,

I am referring to a mgxs generation example from the example git [here]. This example works fine if I run the simulation and post process on the same jupyter notebook. But, if I run the simulation on a separate file and post process on a different notebook by calling the statepoint of the simulation and do the load\_from\_statepoint(sp) function, I get NameError message. For example, for total xs it will be like this NameError: name ‘total’ is not defined.

I think the name is not defined in the tallies xml even if I did:  
total = mgxs.TotalXS(domain=cell, energy\_groups=groups)

tallies = openmc.Tallies()  
tallies += total.tallies.values()  
model.tallies = tallies

Did I miss something here, or is it a bug?

Thanks,  
Yohannes

---

<div class="post-metadata">

**Author:** ![Jiankai](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/jiankai/32/1070_2.png) [@Jiankai](https://openmc.discourse.group/u/Jiankai)\
**Post date:** [November 17, 2022, 5:36pm UTC](https://openmc.discourse.group/t/mgxs-generation-post-process-issue/2486/2 "2022-11-17T17:36:07Z")

</div>

If you divide the example jupyter notebook into two parts and run them individually, you will meet with “undefined” error just as shown in your description. Please carefully define the variables before they are being used in each script.
