# "Object not callable error" on a project script

**URL:** <https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [June 18, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028 "2024-06-18T15:00:29Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/1 "2024-06-18T15:00:29Z")

</div>

I am sure I am missing something in the path or something stupid but -

doing some testing with project script using an event script on a button. I keep getting the error below.

[not callable pdf.pdf](https://forum.inductiveautomation.com/uploads/short-url/9XNiTvak8a3rueef4pqs5NiobGb.pdf) (116.9 KB)

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 3:03pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/2 "2024-06-18T15:03:43Z")

</div>

In the future, post your screenshots and script using preformatted text directly to the forum rather than in a PDF.

Your'e trying to call the script file directly, but you should be calling a function inside the script file.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/3 "2024-06-18T15:08:12Z")

</div>

Thanks for the reply, I do appreciate it.

Can you provide or direct me to examples of either of the items in your reply? pre-formatted text or the calling the function bit?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 3:12pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/4 "2024-06-18T15:12:41Z")

</div>

The pre-formatted text option looks like this: \</\> in the toolbar when you're typing your message.

For scripting, refer to this video in Inductive University. I recommend going through all the videos to learn how to do all the various things you'll do in Ignition. While the videos only teach the basics, it should help with your issue.

> **[Project Scripts Video at Inductive University](https://inductiveuniversity.com/videos/project-scripts/8.1)**
>
> Learn how to create your own scripting libraries in this lesson.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/5 "2024-06-18T15:22:43Z")

</div>

I have watched this video. Just watched again since you recommended, I mean, what kind of jerk would ask for help and then not do what someone recommended, am I right?

Whatever I am doing wrong was not clear to me.

Thanks, again.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 3:34pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/6 "2024-06-18T15:34:26Z")

</div>

The script file you created is called `Sandbox.printToCon` but inside that file there's going to be a function starting with `def`. I don't know what it's called because it's not in your PDF, but let's just assume it's named `printInfo`, so your script call should be `Sandbox.printToCon.printInfo('hello world')`

Edit: To direclty corelate your script to what the video shows, in the video they don't have a package and just a script file named `message` which is the equivalent to your `Sandbox.printToCon`. Their `sayHello` function is what you're missing or not showing.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 3:51pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/7 "2024-06-18T15:51:06Z")

</div>

````python

```yes im with you. Sorry, I had thought my script was in the upload. I did have a function defined there. I have edited it all so it makes more sense:

def printToCon(x):
      print x
Sandbox.print.printToCon('hello world")
The error is now gone but nothing is actually printing to the console. 

That was as big step forward though. I knew I was leaving something out of the path. Too close to the forrest, sort of thing.
````

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/8 "2024-06-18T15:53:43Z")

</div>

If your script is still named `printToCon`, your function call would be:

```python
Sandbox.printToCon.printToCon('hello world')

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 18, 2024, 3:55pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/9 "2024-06-18T15:55:46Z")

</div>

Hi, Sean.  
You're now formatting everything as code. Have a look at [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 3:58pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/10 "2024-06-18T15:58:03Z")

</div>

I changed the second part to "print" to aid in trouble shooting. Looks clearer now. I had forgotten that you can have multiple functions in each packet of scripts in each module so when I had the same name it was, indeed, confusing me.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 4:01pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/11 "2024-06-18T16:01:07Z")

</div>

that was just an accident man. Thanks.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 4:06pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/12 "2024-06-18T16:06:03Z")

</div>

while we are on the subject on how to - is there a wiki about posting pictures the appropriate way?

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/13 "2024-06-18T16:12:22Z")

</div>

Works like a champ in Vision. I must be doing something dim in perspective. I will dive into that.

Cheers.

---

<div class="post-metadata">

**Author:** ![sean\_dysinger](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sean\_dysinger](https://forum.inductiveautomation.com/u/sean_dysinger)\
**Post date:** [June 18, 2024, 4:24pm UTC](https://forum.inductiveautomation.com/t/object-not-callable-error-on-a-project-script/92028/14 "2024-06-18T16:24:50Z")

</div>

Just to close the loop on this for anyone else that comes along. I created a new function in Sandbox.print:

```python
def printToConPerspective(x):
       
      system.perspective.print(x)

```

Then just called that one in the button on the perspective view and it worked enough.

One more "Thanks!" for the help.
