# How to name project script modules properly?

**URL:** <https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212>\
**Category:** Ignition\
**Created:** [March 15, 2022, 3:53pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212 "2022-03-15T15:53:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [March 15, 2022, 3:53pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/1 "2022-03-15T15:53:43Z")

</div>

Hi All  
I had strange problem with message “attributeerror - object has not attribute getlogger” - see screenshot below

One of my project modules was called logging which i think somehow clashed with the external library module. I rename my module from “logging” to “manual\_logging” and error has disappeared.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e9581e9ef2a98d88085a60814e78a04c71c09cbf.png)

Obviously i dont want this to happen in future so:

1 shall i in future give some project specific prefix to all modules ? it makes the name longer but if it needs to be done then it will be done  
2 why did this error happened in the first place??? In call up path “\_socket” library was imported which then tried to create a logger in line 56- see screenshot

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/145117148b554c61893089097b11fc614cbbcae4.png)  
3 in the folder above “\_socket” there is no module called logging only there is a folder with this name - does it suggest that “\_socket” module has some serious fault as it cannot find reference to logging?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/e/6e58974c66c96b76eb6c2aca9b12801f31a5e711.png)  
4 when googling for the solution of the problem i came across discussion about getlogger issue caused by other problem than mine and somebody suggested to recompile the library which supposedly solved that problem.

> <https://github.com/roytseng-tw/Detectron.pytorch/issues/88>
>
> Hi, when I run the benchmark
> \`\`\`
> python tools/train\_net\_step.py \\
> --dataset… coco2017 --cfg configs/e2e\_faster\_rcnn\_R-50-FPN\_1x.yaml \\
> --bs 8 --iter\_size 2 --use\_tfboard
> \`\`\`
> , I got the error:
> \`\`\`
> Traceback (most recent call last):
> File "tools/train\_net\_step.py", line 22, in \<module\>
> import utils.net as net\_utils
> File "/home/yufeiy2/Detectron.pytorch/lib/utils/net.py", line 12, in \<module\>
> logger = logging.getLogger(\_\_name\_\_)
> AttributeError: 'module' object has no attribute 'getLogger'
> \`\`\`
> 
> It seems that in net.py, the script import logging under \`lib/utils/logging.py\`, but should import logging from python site-packages.
> 
> any idea to solve it?
> 
> Thank you.

Did anybody ever had to recompile anything in the ignition python library? How can this be done in theory? I am curious but dont want to touch anything in ignition\python files.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 15, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/2 "2022-03-15T16:00:01Z")

</div>

Within the _Ignition_ execution environment, since 8.0.0, we deliberately inject all of your project scripts into the top level namespace _last_, meaning they’ll override whatever might have already been defined. This _can_ cause problems, but most of the time doesn’t, and the ease of use gain is considered to trump the potential headache of collisions like this.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [March 15, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/3 "2022-03-15T16:07:16Z")

</div>

hi Paul  
thank you for reply but still trying to understand the internals.  
Are you able to help me to understand why in “\_socket.py” there is reference to logging module which is not there? Also point 4 from my question if you have time please

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [March 15, 2022, 4:09pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/4 "2022-03-15T16:09:49Z")

</div>

Also i am still confused how can _injecting all of the project scripts into the top level namespace last_ helped if my problem happened anyway ☹

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 15, 2022, 4:25pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/5 "2022-03-15T16:25:06Z")

</div>

`logging` _is_ there. Inside the folder `logging`, there's an ` __init__.py` descriptor that contains this line:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d232454e1392f6f44aa1fd88605bb55638c1bb12.png)

By defining ` __all__ `, an ` __init__.py` file can choose to expose certain members. This is all Python (2) built in stuff; nothing to do with Ignition.

For your question 4: Compilation is totally irrelevant to you in Jython. Jython does its own "compilation", but it's different from CPython and the error messages you may have seen while searching were almost certainly due to different underlying root causes. You _can't_ trigger recompilation or force it in any way in the Jython environment.

> [@hewking32](#):
>
> Also i am still confused how can _injecting all of the project scripts into the top level namespace last_ helped if my problem happened anyway ☹

Injecting them 'last' isn't specifically done to help avoid any issues; it's just the way it is done. Python has (basically) one global namespace. If you want to refer to the standard library's `logging` module, you _must not have something else named logging_.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [March 15, 2022, 4:44pm UTC](https://forum.inductiveautomation.com/t/how-to-name-project-script-modules-properly/57212/6 "2022-03-15T16:44:11Z")

</div>

thanks a lot for answering my question and also satisfying curiosity 🙂
