how to change a script while it is running

F

faxme

Hi, I would like to know if it is possible to change code on the fly on a
python interpreter. I want to have a python script running a multithread
server and be able to connect to this python script and change the
interpreter environment. Is this possible?
Ideally i would like to call python, load the script inside the python
command line and while the script works still be able to type other python
commands(that might change the running script).

Thanks
 
D

Do Re Mi chel La Si Do

Hi !

Try :


def ff(a):
print a*2

ff(111)

exec('''def ff(a):
print a*3
''',globals(),globals())

ff(111)



@-salutations

Michel Claveau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top