Import Python files into another python file of workspace in Azure databricks
Imagine you created 2 python files namely main.py and greeter.py and you uploaded both in Azure DataBricks workspace inside same directory.

Your main.py looks like this
import greeter
greeter.goodmorning()
Your greeter.py looks like this
def goodmorning():
print("Good Morning")
Now you try running main.py and you will get this error

How do you solve this Import problem and make your code work?
Solution: Append path of your folder to sys.path
So I am adding these lines to main.py
both main.py and greeter.py are present inside testing folder inside Shared part of workspace.
import os
import sys
sys.path.append("/Workspace/Shared/testing/")
Now main.py looks like this
import os
import sys
sys.path.append("/Workspace/Shared/testing/")
import greeter
greeter.goodmorning()
Now let’s try running main.py

If you this tutorial helped you. Please give a clap :)