I do not believe that they can work in one process, that is, you will have to choose one or the other. Python3 and Python2 bytecode are incompatible with each other, which you can confirm by trying to run Python2 bytecode in Python3:
% cat > test.py
a = 1
% python2.6 -m compileall .
% python2.6 test.pyc
% python3.1 test.pyc
RuntimeError: Bad magic number in .pyc file
- , . test.py Python2, .py, , Python3. - .pyc Python3.
% python2.6 -m compileall .
% rm test.py
% cat > test2.py
import test
print(test.a)
% python2.6 test2.py
1
% python3.1 test2.py
Traceback (most recent call last):
File "test2.py", line 1, in <module>
import test
ImportError: Bad magic number in test.pyc