code: def init_connection_file(self):
      if not self.connection_file:
          self.connection_file = "kernel-%s.json" % os.getpid()
      try:
          self.connection_file = filefind(
              self.connection_file, [".", self.connection_dir]
          )
      except IOError:
          self.log.debug(
              "Connection file not found: %s", self.connection_file
          )
          # This means I own it, and I'll create it in this directory:
          ensure_dir_exists(
              os.path.dirname(self.abs_connection_file), 0o700
          )
          # Also, I will clean it up:
          atexit.register(self.cleanup_connection_file)
          return
      try:
          self.load_connection_file()
      except Exception:
          self.log.error(
              "Failed to load connection file: %r",
              self.connection_file,
              exc_info=True,
          )
          self.exit(1)
  
imports: from __future__ import print_function
  import atexit
  import os
  import sys
  import signal
  import traceback
  import logging
  from tornado import ioloop
  import zmq
  from zmq.eventloop import ioloop
  from zmq.eventloop.zmqstream import ZMQStream
  from IPython.core.application import BaseIPythonApplication, base_flags, base_aliases, catch_config_error
  from IPython.core.profiledir import ProfileDir
  from IPython.core.shellapp import InteractiveShellApp, shell_flags, shell_aliases
  from IPython.utils import io
  from ipython_genutils.path import filefind, ensure_dir_exists
  from traitlets import Any, Instance, Dict, Unicode, Integer, Bool, DottedObjectName, Type, default
  from ipython_genutils.importstring import import_item
  from jupyter_core.paths import jupyter_runtime_dir
  from jupyter_client import write_connection_file
  from jupyter_client.connect import ConnectionFileMixin
  from .iostream import IOPubThread
  from .heartbeat import Heartbeat
  from .ipkernel import IPythonKernel
  from .parentpoller import ParentPollerUnix, ParentPollerWindows
  from jupyter_client.session import Session, session_flags, session_aliases
  from .zmqshell import ZMQInteractiveShell
label_desc: Use image node_id 9 for calling the IPKernelApp obj's underlying member method code with example usage: obj.init_connection_file() without return types