Wolfram Computation Meets Knowledge

How do I use packages with CDF?

Read this article in: Deutsch, Español, Français, 한국어, Português


NOTE:
Computable Document Format (CDF) is a legacy document type, superseded by Wolfram Notebooks.

Functions can be stored and included in the code of any CDF file.

  1. Place the package where Wolfram Player can find it. If the package is used only by a specific CDF file, place it in the same folder as your CDF file. If you would like to reuse the package, place it in the Player’s apps folder:

    On Windows:

     C:\Program Files\Wolfram Research\Wolfram Player\14.1\AddOns\Applications 

    On macOS:

     /Applications/Wolfram Player.app/AddOns/Applications 

    In either case, note the folder in which you have placed the CDF package.

  2. Load the package inside the Initialization option for the Manipulate or DynamicModule, providing its complete path:
     Initialization -> {Needs["mypackage`", "PathToPackage" <> "mypackage.wl"]}  

    Where “PathToPackage” is the folder from Step 1.

  3. When calling functions from the package, provide the context of the function, which is the package name. For example, to use myfunc[] from package mypackage.wl, use the following code:
     mypackage`myfunc[] 
Is this article helpful?
Yes
No

Any comments?

Thank you for your feedback.

Submit

Contact Support

Whether you have a question about billing, activation or something more technical, we are ready to help you.

1-800-WOLFRAM (+1-217-398-0700 for international callers)

Customer Support

Monday–Friday
8am–5pm US Central Time

  • Product registration or activation
  • Pre-sales information and ordering
  • Help with installation and first launch

Advanced Technical Support (for eligible customers)

Monday–Thursday
8am–5pm US Central Time

Friday
8:30–10am & 11am–5pm US Central Time

  • Priority technical support
  • Product assistance from Wolfram experts
  • Help with Wolfram Language programming
  • Advanced installation support