When code in a package is compiled, it may need to access features of its local app, appContext, global, currentSession, and currentSchema system variables. Several sets of environmental objects or references are maintained for each process. There is one set for the schema of the process itself and one for each schema from which a package is imported.
The current schema context is maintained for each process. When a method is dispatched that is bound in a schema that differs from the current context, the current context is updated. Similarly, when a method returns, the current context is updated.
If a process is using two packages from different schemas, for example, that process has three app objects (one for each imported package schema and one for the main process). As all application objects should have the same printer, for example, if the printer is changed by any code executed by the process, the change is reflected across all application objects.
If you have two packages (for example, p1 and p2), the second package (p2) imports the first package (p1), and a third schema imports both the p1 and p2 packages, there will be two instance of app for the first package (p1); that is, one in the context of the importing schema and the other in the second p2 package.
Similarly,
The appContext system variable enables a package to switch context back to the context of the application that imported the package, using the