Cannot import function from modules

Hello, sorry for the newbie question but I’m very confused about loading modules into jupyter. I have written a module to a .py file with some very simple matplotlib functions as shown below. This file is saved as module.py

%%writefile ‘module.py’
from matplotlib import pyplot as plt
def plot_accuracy(acc,val_acc):

Plot training & validation accuracy values

plt.figure()
plt.plot(acc)
plt.plot(val_acc)
plt.title(‘Model accuracy’)
plt.ylabel(‘Accuracy’)
plt.xlabel(‘Epoch’)
plt.legend([‘Train’, ‘Test’], loc=‘upper left’)
plt.show()

def plot_loss(loss,val_loss):
plt.figure()
plt.plot(loss)
plt.plot(val_loss)
plt.title(‘Model loss’)
plt.ylabel(‘Loss’)
plt.xlabel(‘Epoch’)
plt.legend([‘Train’, ‘Test’], loc=‘upper right’)
plt.show()

I’m trying to load functions from this module into another notebook using

from module import plot_accuracy, plot_loss

but I get the error


ImportError Traceback (most recent call last)
in
----> 1 from module import plot_accuracy, plot_loss

ImportError: cannot import name ‘plot_loss’ from ‘module’

I’m not quite sure what I’m doing wrong since as far as I can tell plot_loss should be defined just fine within the module.

Thanks!