How to Run a Python File Using Another Python File Using Subprocess (Very Easy)

preview_player
Показать описание
It's very simple. In this video, I demonstrate how to run a python file using another python file. This is a nice trick to know and can be useful in some cases. Simply, import the call function from subprocess and use the call function.

I hope you guys find this video helpful. Feel free to like, subscribe, and share this video.

Code used in this video:

from subprocess import call

def open_py_file():

open_py_file()
Рекомендации по теме
Комментарии
Автор

Mad lad. Took me decades too long to find an explanation for this

Trullatz
Автор

I like how this is short and very accurate, NC

arjaytv
Автор

Very nice ! Short and good. Many thanks. Needed this. 🙂

iiannRB
Автор

Thanks man. That's exactly what i looked for!

ceo-s
Автор

Thankk youuu mannn!!! That's what i was looking forrr. Gladd i watched ur video.. Thnxuu🤞

harpreetkaur
Автор

Excellent to learn about that. This is a good program language. Thank you for sharing 👍

Mombierella
Автор

Dude. I've been struggling to form any real understanding of code & for some reason this video made a tiny bit of sense to other past videos I watched. Still not much of an understanding, but i seent it now🧠🤕

tnastyartdaddy
Автор

I was looking to open a DIFFERENT command prompt for my py files though, could you help me about that?

volden
Автор

is there a way to do this without pausing the program

TWLynx
Автор

I was going to use this before Chat GPT told me about Queueing.

JustRollin
Автор

"python: can't open file [Errno 2] No such file or directory" I HAVE THIS STUPID PROBLEM LIKE ALWAYSS

mariusduminica
Автор

u seem to cover epico topics can u make a tutorial/build a function to be called only x amount of times like for example:-

for i in range(10):
print("hello world") # control string
async_loop(1, lambda: print("world hello")

____________________________x
Автор

i dont know but for some reason im giving the command and trying to run it but its returning to the next line

atikeshivakrishna
Автор

when i call another python with print ('hello') works fine but when I use packages like import requests inside a callable program when it runs, the program errors out with no module found requests.

jaiksah
Автор

This was helpful but.... Youstarted well showing each stage slowly and carefully but for the last part with gallery you did too much too fast. It became impossible to follow.

Stafford
Автор

how do I return data or information from the file that was called? Also can I send input parameters from the main file

hussainbhavnagarwala
Автор

does each script utilize their own processes or is it a single one shared to all?

frankieiero
Автор

will ti be possible run this in blender

chari
Автор

when I run my file "abc.py" this script, I got the error "No module named 'keyboard". Although I can run "abc.py" manually normally.

giratinum
Автор

Hey bruhh, thanks for this excellent video, it will be so much helpful if you can send the Source Codes of these two 2:52

amxn