1 | initial version |
Note that the Sage console is using IPython. This question on stack overflow leads to the following trick
def func()
print('Hello!')
if __name__ == '__main__' and '__file__' in globals():
func()
(does work for me with both %runfile
and %attach
)