Can I call one public function in one DB's script library from another DB's LS code?

I tried but it failed. Thanks for help !

Subject: Can I call one public function in one DB’s script library from another DB’s LS code?

No, you can’t. That’s why it failed.

You can however have the same script lib in both databases and you can have them inherit from the same template, so they will be always on the same, current level.

Subject: RE: Can I call one public function in one DB’s script library from another DB’s LS code?

Thank! But the information is located in another database and there is a public function to get it and I want to re-use.

Is it possible I can call an agent through agent.Run() or agent.RunOnServer(), so the agent on another database will return some results?

Subject: RE: Can I call one public function in one DB’s script library from another DB’s LS code?

Yes, an agent in the other database does have access to the function in this script lib, and you can call it e.g. using agent.RunOnServer. But your calling code will not wait for the called agent to finish, nor will it have any other means to directly fetch this agent’s results. That means, that the agent you call will have to do all the work, to e.g. create or update documents in the first database, if required.

Consequentially, you will have to pay more attention to access rights between those databases. You’ll have to decide, which variant is easier to develop and to maintain in your environment.