Previous Topic

Book Contents

Book Index

Next Topic

Creating and Using Valuemation Libraries

To create your own library, do the following:

  1. Create a new workflow and set the type to 'Library'.

    Help Image

    It is recommended that you name the workflow according a module.

    As the name of the workflow will be the name of the package, don't use any spaces, dots or other special characters.

    Note that it won't be possible to add such a workflow to the sidebar or create an action for it as it serves just as a storage container for libraries (one or more script nodes).

  2. Add a script node.

    Help Image

    Name it again without any spaces, dots or other special characters.

  3. Open the script in the Script Editor and add at least one function or class to it.

    Help Image

  4. When you save the script, a corresponding .py file will be created in vmcache/<db>/lib/vm/<workflowname>/<scriptname>.py

    This 'library' cache is updated any time you create or modify a library either at Valuemation startup or when you press F5 on the library tab in the Script Editor.

  5. To use the new function from the library, simply add the import statement 'from vm.<workflowname>.<scriptname> import *' and call the function.

    See also the 'Script Editor' section to learn more about using the libraries.

 

Notes:

  • Pay attention to good naming of the workflow and script nodes (package and libraries).
  • Remember to add documentation strings (in triple quotes) to the library and all its functions and classes.
  • Note that you cannot simple rename a library workflow/script once it is called from other scripts. Similarly, you cannot remove or rename functions, classes (or their methods) or change their arguments.

See Also

Script Libraries

Installing and Using Standard Libraries