# Using python help function

**URL:** <https://forum.inductiveautomation.com/t/using-python-help-function/9482>\
**Category:** Ignition\
**Created:** [December 23, 2014, 5:49pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482 "2014-12-23T17:49:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blefe001](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Blefe001](https://forum.inductiveautomation.com/u/Blefe001)\
**Post date:** [December 23, 2014, 5:49pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482/1 "2014-12-23T17:49:15Z")

</div>

I am trying to dig into the hidden component features using python scripting. I can see all the available function in the component when I use “print dir(component)” however once I find the function I want to use I do not always know what parameters it takes. Is there a way to use the built in help function in python to have it display the parameters for the function?

When I try to just use help (component.functionName()) it gives me the error  
[color=#FF0000]Traceback (most recent call last):  
File “event:mouseClicked”, line 1, in   
NameError: name ‘help’ is not defined  
[/color]

---

<div class="post-metadata">

**Author:** ![Blefe001](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Blefe001](https://forum.inductiveautomation.com/u/Blefe001)\
**Post date:** [January 20, 2015, 5:06pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482/2 "2015-01-20T17:06:07Z")

</div>

Is this function not supported?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 20, 2015, 5:47pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482/3 "2015-01-20T17:47:36Z")

</div>

According to [Python documentation](https://docs.python.org/2/library/functions.html#help) you have to import the site module.

Example:

```auto
import site
print help([])
```

Best,

---

<div class="post-metadata">

**Author:** ![Blefe001](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Blefe001](https://forum.inductiveautomation.com/u/Blefe001)\
**Post date:** [January 20, 2015, 7:41pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482/4 "2015-01-20T19:41:29Z")

</div>

Thanks Nick,

We are getting closer. Now if I run the code

`import site
print help(event.source.getChart().getPlot())`

I get this for the output in the console.

[quote]Help on PiePlot object:

\<type 'org.jfree.chart.plot.PiePlot'\>  
None  
[/quote]

So if I look in the functions available inside event.source.getChart().getPlot() using the dir function

```auto
print dir(event.source.getChart().getPlot())
```

I can see that there is a function that is called setOutlinePaint() which is self explanatory, it sets the color of the outline paint which can be used to get rid of the unnecessary boarder that comes with the component. It took me awhile to find what this function took as a parameter(which is just a color in either HEX or RGB). So if I plug the following into the help function

`import site
print help(event.source.getChart().getPlot().setOutlinePaint())`

I get an error saying

> [@](#):
>
> TypeError: setOutlinePaint(): expected 1 args; got 0

I would like to be able to find the function with the dir function and then plug that function into the help function to see what parameters it takes and how the function works. Any thoughts on that?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 20, 2015, 8:00pm UTC](https://forum.inductiveautomation.com/t/using-python-help-function/9482/5 "2015-01-20T20:00:35Z")

</div>

Hi,

You got that error because you called the function without passing in the argument that it expects. It will work if you pass in the function without calling it. Example:

```auto
import site
print help(event.source.getChart().getPlot().setOutlinePaint)
```

But really the “help” function isn’t going to help you because it is only useful on native Python objects, such as Python lists and dictionaries and other Python stuff. The components in Ignition are written in Java, not Python, so “help” is not going to help.

You can use “dir” to find methods on objects. To learn more, like information about method parameters, you will need to use the [Java Reflection API](http://docs.oracle.com/javase/tutorial/reflect/).

Sometimes an easier way is to find and read the underlying documentation for the technologies that Ignition is using. For example the charts in Ignition use [JFreeChart](http://www.jfree.org/jfreechart/api/javadoc/index.html). Or read [Swing documentation](https://www.google.com/search?q=Swing+documentation&ie=utf-8&oe=utf-8#q=Swing+documentation). Many components in Ignition are built from Swing components.

Best,
