Hello Community,
I am seeking assistance on how to run Python codes with imported scripts directly from GitHub on Sage Cell. Typically, it is possible to execute a single script by using the raw content path, as shown below:
load("
https://raw.githubusercontent.com/xxxxxxxxxxxxxx")
I am now exploring how to execute a Python code with imported scripts, as demonstrated in the example below:
graphs.py:
class Plotting:
def __init__(self):
#Import the module containing the plot_line function
import plotting_line
def plot_bar(self, data):
#Call the plot_line function from the imported module
plotting_line.plot_line(data)
plotting_line.py:
def plot_line(data):
#Do something to plot a line graph with data
print("Creating line plot with data:", data)
#Create an instance of the Plotting class
plotter = Plotting()
plotter.plot_bar([1, 2, 3, 4, 5]) #Call the plot_bar method with a list of data
I would greatly appreciate any help or guidance on how to achieve this.
Kind regards,
Elimboto