Write Audit Entry From Script?

I’ve noticed that activity from within a script does not appear to add audit log entries. Is there a way to add arbitrary audit log entries from within a script? For example I have scripts that copy pins, delete/add tokeninfo, etc and I would like audit entries when these actions are performed to appease the auditors.

The piece of information I’m missing is how to create/access the audit object itself since I do not appear to have access to current_app.config from within the script.

Please be more precise. “a script does not appear to add audit log entries”.

What is a “script”?

A script could intiate API calls. Then these would get added.
Only API calls (which is the normal behaviour) are added.
No pi-manage calls. No library calls.

I’m using library calls from within an event handler script. Is it possible to utilize library calls to create audit entries?

No. This is also not the originial sense of audit entries.
Audit entries are started at the beginning of a request and finalized at the end.

If you need audit entires, your scripts should use the API.

Will do, thanks! I was just hoping to not have to store administrative credentials in another location.