Global Imports

Imports done under each code block will work only inside it. Users can add a package or function to Global Imports section to make it available across all the blocks in the canvas.

How to set global import commands

Once a package is imported in Global Imports, it can be used in any block in the Notebook

How to set local, block-level import commands

For larger packages like pytorch - which are required to be run only on specific blocks - we can use block level imports.

As seen in the screenshot below, torch wasn't imported globally and at a block level. The first block imports torch and runs, but the second block gives an error as torch wasn't imported locally.

Last updated