Shared libraries or functions

What is the best way to share python functions in datalore?
Is it possible to import other notebooks and their function definitions?

Hello,

You cannot import one notebook from another, but you can extract your shared code to .py files in the workspace files folder, and then import them like any other library.

For example, if you have shared.py file in your workspace files with the following content:

def greet():
  print('Hello!')

You can then use it in your notebook:

from shared import greet
greet()

Keep in mind that when you change your shared files, you might need to restart kernel to apply the changes.

Thank you. A restart of the kernel doesn’t seem necessary.
Changes are being picked-up after save.

1 Like