0

I have two python blocks. If I execute blockA, then execute blockB, it works fine. How can I only execute blockB without manually executing blockA? I am thinking add a :var from blockA` but it does not work:

#+name blockA
#+begin_src python :session :results output
def funcA():
    print("funcA")
    return
#+end_src

#+RESULTS:

#+name blockB
#+begin_src python :session :results output :var x=blockA
def funcB():
    funcA()
    print("funcB")
    return

funcB()
#+end_src

1 Answer 1

1

You are missing colons after the #+name. This works fine:

#+name: blockA
#+begin_src python :session :results output
def funcA():
    print("funcA")
    return
#+end_src

#+name: blockB
#+begin_src python :session :results output :var x=blockA
def funcB():
    funcA()
    print("funcB")
    return

funcB()
#+end_src

#+RESULTS: blockB
: funcA
: funcB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.