class MyClassifier:
    clf = None

@staticmethod
def is_loaded():
    return MyClassifier.clf is not None

@staticmethod
def load_models(config):
    path = SparkFiles.get(config.get('model_file'))
MyClassifier.clf = load_from_file(path)
MyClassifier.load_models(config)
How to run a function on all Spark workers before processing data in PySpark?