# Expose User Script Functions in Auto Complete

**URL:** <https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 1, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621 "2022-02-01T18:14:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 1, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/1 "2022-02-01T18:14:38Z")

</div>

I was thinking that it would be nice to allow user script packages/functions to be added to auto complete. Is this something that would have to be a custom module? I also wonder if you could write a script that could loop through a script package/file and return all of the contained function definitions and parameters?

---

<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:** [February 1, 2022, 6:42pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/2 "2022-02-01T18:42:32Z")

</div>

It _would_ be nice 🙂  
We’re actively working on improvements to the script editor. Autocomplete for user functions won’t make the first round of improvements, but is definitely on the list to add.

It wouldn’t really be possible through a custom module; you wouldn’t have any good place to hook in to deliver autocompletion even if you had it.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 1, 2022, 7:37pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/3 "2022-02-01T19:37:35Z")

</div>

This isn’t too shabby for quick and dirty module inspection

Module: `test`

```auto
def testFunc1(a):
	x=1 	
def testFunc2(a,b):
	x=1 		
def testFunc3(a,b,c):
	x=1 	
def testFunc4(a,b,c,d):
	x=1 

```

```auto
code = test.getCode()
defs = code.split('def')
for definition in defs:
	print definition.split(':')[0]

```

Ouput

```auto
 testFunc1(a)
 testFunc2(a,b)
 testFunc3(a,b,c)
 testFunc4(a,b,c,d)

```

---

<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:** [February 1, 2022, 7:52pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/4 "2022-02-01T19:52:08Z")

</div>

> [@dkhayes117](#):
>
> `code.split('def')`

Blegh. What happens when the three letters "def" show up elsewhere? Instead, use `dir()` to give you all the symbols, `getattr()` to extract the objects, and `callable()` to distinguish code from variables.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 1, 2022, 7:56pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/5 "2022-02-01T19:56:47Z")

</div>

Yea I suppose this sort of thing would break it

```auto
def coolMaths():
    # definitely change this later
    x = 1 / 0

```

If possible I think it would be very helpful if too that you autocomplete of user functions could grab the doc string of the function and display it the way the built-in’s work

```auto
def myFunct(a, b):
    """
    Show the stuff in here
    Args:
        a: int, description
        b: string, description
    Returns:
        someReturnVal
    """
    pass

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 1, 2022, 9:02pm UTC](https://forum.inductiveautomation.com/t/expose-user-script-functions-in-auto-complete/55621/6 "2022-02-01T21:02:27Z")

</div>

I’m ignoring classes, methods, and the kwarg stuff for now…

```auto
from inspect import isfunction, getargspec
modObj = project.test
syms = dir(modObj)
for sym in syms:
	attr = getattr(modObj, sym)
	if isfunction(attr): 
		print "%s(%s)" % (sym, ','.join(getargspec(attr)[0]))

```
