I don't know how to run the python scripts in parent directory using Jupyter Notebook's magic command %run script_name. I attempted to add the parent directory path into the sys.path as I did in the following code but it's not helpful. I also tried using %run /home/parent_directory/script_name (i.e. the abs path of the script) but it does not work either. Any suggestions? Current file running the magic cell is located at /home/parent_directory/Child_dir/script.py.
Parent_directory = os.path.abspath('/home/parent_directory')
if Parent_directory not in sys.path:
sys.path.append(Parent_directory)