After source_python
to get the result, can I close or restart the python console? If so, how?
And suppose I closed/restarted the python console, would I still be able to access in R the variables and functions that were created in source_python
before?
No, I don't believe this is possible. Your issue is discussed here.
Quoting @jjallaire (one of the devs, and CEO of RStudio): "No, you can't safely unload and reload the connection to Python (too many unreversable side effects in the Python interpreter)".
Restarting the python connection requires restarting R.