import os, sys, zipfile, tempfile
script_dir = os.getenv("SCRIPT_DIR")
# Create a persistent temporary directory
temp_dir = tempfile.TemporaryDirectory()
extracted_scripts_path = None
if script_dir.startswith("jar:"):
jar_path = script_dir[len("jar:"):]
jar_path = jar_path[:jar_path.find("!")]
with zipfile.ZipFile(jar_path, 'r') as jar_file:
jar_file.extractall(temp_dir.name)
extracted_scripts_path = os.path.join(temp_dir.name, "Files")
else:
extracted_scripts_path = script_dir
sys.path.append(extracted_scripts_path)
# any imports from here to local scripts are valid
from First_Python import func1
print(func1(4, 7))