import os from subprocess import Popen # Define your desired log directory log_dir = "./" # Ensure the log directory exists if not os.path.exists(log_dir): os.makedirs(log_dir) # Start TensorBoard Popen(["tensorboard", "--logdir", log_dir, "--host", "0.0.0.0", "--port", "6006"])