I defined a macro inc in Jupyter Notebook. I can run a macro from another cell. However, the macro cannot be run in the for loop.
[1]
x = 0
[2]
x += 1
[3]
%macro inc 2
[4]
inc
[5]
x
outputs 2
[6]
for _ in range(10): inc
[7]
x
still outputs 2.