Depending On Other Apps
Reusing Components and Code
You can reuse Forms, Custom Components and code from one Anvil app in another by making the app available as a library. Choose “Dependencies” from the Gear Menu .
Making an app available as a library
In the example below, we have made the current app available under the package name “My_App
”. This means that
Forms, Custom Components and modules from this app
can be used by any app that has this app as a dependency.
Using other apps as libraries
In this example, we have also imported the Useful Components app (which has the package name useful_components
).
Any custom components in that app will now show up in the Toolbox in this app:
You can choose to depend on the Published or Development (most recent) version of the app. Note that if the library app does not have a published version, both options will refer to the most recent version.
You can also refer to library apps in code by importing them as packages. In this way, you can use custom components and modules from libraries directly.
from useful_components.Widget import Widget
self.add_component(Widget())
Any dependencies of an app you depend on will also be available to your app (dependencies are transitive).
It is only possible to depend on apps that you own (or your organisation owns). To use an app that someone else wrote as a library, you should clone their app and then depend on your copy.
Sharing Data Tables
The same Data Tables can be used by multiple apps. See Sharing Data Tables Between Apps for more information.
Do you still have questions?
Our Community Forum is full of helpful information and Anvil experts.