If I create the comint buffer myself and then make that inline python function call in the org document, then it works. Below is the lisp I evaluated to make the comint buffer myself based on what I saw in the Backtraces. (python-shell-make-comint "python" "python-chain" nil) Here is the Backtrace where I tried to compare what happens when I need to press C-g. #+begin_example C-c C-c needs to make comint shell Debugger entered--returning value: 0 alist-get(yas--post-command-handler ((python-shell-font-lock-post-command-hook . 0) (yas--post-command-handler . 0) (company-post-command . 0) (company-post-command . 0) (yas--post-command-handler . 0) (vertico--exhibit . -90) (consult--preview-post-command . 0) (vertico--exhibit . -90) (eldoc-schedule-timer . 0) (eldoc-schedule-timer . 0) (eldoc-schedule-timer . 0) (eldoc-schedule-timer . 0) (eldoc-schedule-timer . 0) (python-shell-font-lock-post-command-hook . 0) (jit-lock--antiblink-post-command . 0) (company-post-command . 0) (company-post-command . 0) (yas--post-command-handler . 0) (yas--post-command-handler . 0) (company-post-command . 0) (yas--post-command-handler . 0) (vertico--exhibit . -90) (vertico--exhibit . -90) (consult--preview-post-command . 0) (vertico--exhibit . -90) (vertico--exhibit . -90) (consult--preview-post-command . 0) (vertico--exhibit . -90) (vertico--exhibit . -90) (company-post-command . 0) (yas--post-command-handler . 0) (hl-line-highlight . 0) (magit-section-update-highlight . 90) (vertico--exhibit . -90) (vertico--exhibit . -90) (company-post-command . 0) (yas--post-command-handler . 0) (magit-section-update-highlight . 90) (consult--preview-post-command . 0) (vertico--exhibit . -90) (company-post-command . 0) (yas--post-command-handler . 0) (magit-section-update-highlight . 90) (company-post-command . 0) (yas--post-command-handler . 0) (magit-section-update-highlight . 90) (vertico--exhibit . -90) (consult--preview-post-command . 0) (vertico--exhibit . -90) (eldoc-schedule-timer . 0) ...) 0 nil eq) ,* #f(compiled-function (f1 f2) #)(yas--post-command-handler python-shell-font-lock-post-command-hook) ,* add-hook(post-command-hook python-shell-font-lock-post-command-hook nil local) python-shell-font-lock-turn-on() inferior-python-mode() python-shell-make-comint("python" "python-chain" nil) run-python("python") org-babel-python-initiate-session-by-key("python-chain") org-babel-python-initiate-session("python-chain") org-babel-execute:python("print(\"testing12\", end=\"\")" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "results") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "python-chain"))) org-babel-execute-src-block(nil ("python" "print(\"testing12\", end=\"\")" ((:results . "output replace") (:exports . "results") (:session . "python-chain") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) nil nil 360 "(ref:%s)")) org-ctrl-c-ctrl-c(nil) funcall-interactively(org-ctrl-c-ctrl-c nil) command-execute(org-ctrl-c-ctrl-c) #+end_example #+begin_example comint shell already exists Debugger entered--entering a function: ,* comint-snapshot-last-prompt() ,* comint-send-string(# "__PYTHON_EL_eval(\"try:\\n with open('/var/folder...") python-shell-send-string("try:\n with open('/var/folders/kf/zdpzgs9d30b3jj...") org-babel-python--send-string("*python-chain*" "with open('/var/folders/kf/zdpzgs9d30b3jj4bdkdjf1v...") org-babel-python-evaluate-session("*python-chain*" "print(\"testing12\", end=\"\")" output ("replace" "output")) org-babel-python-evaluate("*python-chain*" "print(\"testing12\", end=\"\")" output ("replace" "output") nil) org-babel-execute:python("print(\"testing12\", end=\"\")" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "results") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "python-chain"))) org-babel-execute-src-block(nil ("python" "print(\"testing12\", end=\"\")" ((:results . "output replace") (:exports . "results") (:session . "python-chain") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) nil nil 360 "(ref:%s)")) org-ctrl-c-ctrl-c(nil) funcall-interactively(org-ctrl-c-ctrl-c nil) command-execute(org-ctrl-c-ctrl-c) #+end_example