V
V
vladqwelkj2020-05-15 11:57:11
Python
vladqwelkj, 2020-05-15 11:57:11

How to link one python program to another python program?

There is a script that should perform certain actions when it is accessed by another python script. What is the best way to implement such a connection? So far, only writing a server API that will work locally, or using sockets, has come to mind. Are there any more elegant solutions? Both scripts run on the same machine.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Karbivnichy, 2020-05-15
@vladqwelkj

Take Bottle: Python Web Framework , use it to sketch api (you can do it in 10 minutes). And refer to the second script by api. The advantage of bottle is that this framework is compact and fits in just one file.

V
Vladimir Korotenko, 2020-05-15
@firedragon

Pass parameters to it when calling

V
Vladimir, 2020-05-15
@vintello

celery and rabbit - this is the gentleman's set that will suit everyone :)

A
Andrew, 2020-05-15
@OdAs

Personally, I use the import command. In this way, I import the file into the desired one and there I can already use the classes, functions and variables of the imported file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question