Calling function from scripting fails on first load

I'm using a custom function from my Scripting on a binding. When it runs for the first time, the import fails, but if I force the binding again it works.

image
image

If you are trying to import your project library scripts, don't they are auto imported for you and should be referenced by their fully qualified name.

2 Likes

I'm not importing them:

def transform(self, value, quality, timestamp):
    costs = scripts.opportunities.review.costs.calculate_review_costs(value)
    return costs

Is there an import on line 1 of scripts.opportunities.review.costs?

1 Like

Is the binding NULL to start? Is it a query binding or similar that takes a second to get a value? What is the binding you are doing the transform on.

Oh, I didn't check that thoroughly when @lrose told me that. Indeed, there was an import on the first line :melting_face:

from scripts.tools.auth import auth
@auth
...

Removing the import fixes the issue, thanks!

3 Likes

The full binding had a check to avoid unwanted values. Looks like the import was the problem :sweat_smile:

1 Like

Yup never ever do this for your own scripts!

1 Like