I have tried to import another python file in my current pyspark program using Sparkcontext.It was giving me error as multiple spark context cannot run at once.Hence I am using spark session to import my python file. My code is :
spark = SparkSession.builder.appName('Recommendation_system').getOrCreate()
txt=spark.addFile('engine.py')
dataset_path = os.path.join('Musical_Instruments_5.json')
app = create_app(txt,dataset_path)
I am getting error as follows:
AttributeError: 'SparkSession' object has no attribute 'addFile'
What will be the correct way of importing python file using spark session.