Error run script project and shared with MongoDB

Hi,

I created a module with the driver of MongoDB and it works only with a project script (with a button in a window). It is under the Script Library [project].
Then I want to call it in the value changed of one tag. I enclose one picture.

When I try to run the script in a value changed, I have this error:

Value Changed Error executing script. Traceback (most recent call last): File "<tagevent:valueChanged>", line 16, in valueChanged NameError: global name 'project' is not defined ERROR
How can I do this?

I tried to put the script in shared scripts and here the scripts work, but I have the error in import library of mongoDb. So i must use a Project Section.

Can I help me?

You can’t run a project script from a tag - tags are global. Make it a global/shared script and it should be accessible.

I can’t put the script in a shared scripts, because in the global scripts i have the error with MongoDB library (ignition in shared script don’t find the mongodb module).
How can I run the script also without value changed, but every 5 minutes?