# Comments Panel Extension Function NameError: self is not defined

**URL:** <https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [June 20, 2018, 7:09pm UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544 "2018-06-20T19:09:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill.diblasi](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@bill.diblasi](https://forum.inductiveautomation.com/u/bill.diblasi)\
**Post date:** [June 20, 2018, 7:09pm UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544/1 "2018-06-20T19:09:07Z")

</div>

I am defining the insertNote extension function for a Comments Panel, Ignition 7.9.7, and I am having trouble using the ‘self’ reference.

The Comments Panel is in a template, and the problem is occurring while testing in the template design window. I have enabled the insertNote extenstion function and have the following code:

```auto
name = self.name
print name

```

I get the following error:

```auto
  File "<extension-method insertNote>", line 15, in <module>
NameError: name 'self' is not defined

```

Update: None of the method’s arguments are available to me (self, note, filename, sticky)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 20, 2018, 7:17pm UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544/2 "2018-06-20T19:17:39Z")

</div>

Sound like you didn’t indent your code properly.

---

<div class="post-metadata">

**Author:** ![bill.diblasi](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@bill.diblasi](https://forum.inductiveautomation.com/u/bill.diblasi)\
**Post date:** [June 20, 2018, 7:30pm UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544/3 "2018-06-20T19:30:38Z")

</div>

You are correct! Working with the “”" section of code threw off my perception a bit. Having the large block of text between the `def` and my code made me miss the indentation.

---

<div class="post-metadata">

**Author:** ![pweber](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@pweber](https://forum.inductiveautomation.com/u/pweber)\
**Post date:** [April 21, 2020, 10:45am UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544/4 "2020-04-21T10:45:42Z")

</div>

if this is the only code in the script:

name = self.name  
print name

how is is not indented correctly?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 21, 2020, 11:52am UTC](https://forum.inductiveautomation.com/t/comments-panel-extension-function-nameerror-self-is-not-defined/18544/5 "2020-04-21T11:52:27Z")

</div>

It needs to be indented to the def of the function, where self is defined. for example:

```python
def insertNote(self, note, filename, sticky):
	name = self.name
	print name

```
