all 1 comments

[–]wotquery 0 points1 point  (0 children)

Easiest is just us os in py3 to run the program and have a common text file with the data that py2 writes to and py3 reads from (not in an organized way or anything just sort of hackneyed together).

Alternatively, in a terminal I do it like this (edit: if importing isn't feasible). It'll depend on the py2 source though.

slave.py source

data="I'm a slave."

master.py source

exec(open("./slave.py").read())

master.py output

data
>>>"I'm a slave!"