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.
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.
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.
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
?
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
from scripts.tools.auth import auth
@auth
...
Removing the import fixes the issue, thanks!
The full binding had a check to avoid unwanted values. Looks like the import was the problem
Yup never ever do this for your own scripts!