I'm not entirely sure how to answer that so let me start from the very start.
Fundamentally, Latex is a language that allows you two define, format, and write text documents. You don't have objects and functions like in most programming languages. In the end, it is compiled to a static document.
Therefore, I'm not sure why you are interested in a python integration.
You could write a Python program that generates a static tex file, which is then compiled to a pdf (if you use pdflatex). But that is cumbersome and more work than writing the latex file in the first place.
There might be an edge case where dynamic programming elements are useful, but tex does support some basic programming capabilities. SO, I don't really see how it could be useful.
Besides the question of usefulness, I understand that some people use Python to generate data/plots for their documents.
Most people I know, generate plots/data with python and then import the plots or csv files in latex. There is no copy/pasting involved.
I've seen that PythonTex is designed for cases where you would like to add pyhton code to your document, which is fine. However, as it is in most programming languages, I wouldn't recommend having one large file containing all the code. It's just bad practice.
But, if you use separate tex file anyway, there is no benefit over having separate python and tex files. You can automate the compilation process with MAKE or CMAKE (or any other building environment of your choice).
To answer your question, I don't think there is a Python integration in Latex besides PythonTex. I don't think that you could use an \import
or \include
command within the pycode
environment. (I haven't tested it though).
SO I don't see how you can do it from a latex side. Having said that, you might be able to import from a file with Python code within a latex document. (see here).
If I can give you a personal advice: I would recommend learning Latex, if you write a large document (book, thesis, ..) or publications (conferences or journals). Latex looks generally better and is more stable than MS Word/Libreoffice/Openoffice. YES, it is awkward to learn and has a steep learning curve. But it works well.
I, personally, use it for most of my documents in personal and professional life.
I use MAKE files to compile my documents (which includes: running simulations written in C, executing R files, generate tables and plots, and finally compile tex).
It works well.
https://github.com/gpoore/pythontex/issues/89
There is an workaround to add folder with your.py
file toPATH
. Its cumbersome, but possible. I am affraid that this is for some time as good as it gets ...