I have created a python file (.py) that includes two different functions.
For example,
def function1():
print("Hello World")
def funtion2(a, b):
y=a+b
if y>=5:
print("Correct")
else:
print("Wrong")
Now, I want to use those two functions in a Databricks Notebook. What I did, was to follow the steps written in this databricks post. Even though I succeeded on creating an egg file that was later imported as a library in databricks I didn't manage to import my custom functions from the egg file. Please check the screenshots below:
setup.py

egg file on Databricks

When I try the python command:
import function2
I get an error that this module was not found. I appreciate any help and comments.
Note: init.py file is not used
I found the following solution after some searching in the Web:
For example -
Libwith any functions/classes there (no runnable code).
Main all the classes and functions from Lib to Main use this command:
%run "./Lib"
(this will work like: from Lib import *)Lib from Main notebook.This is the online post with the information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With