run .py files with .py files

This is the place for queries that don't fit in any of the other categories.

run .py files with .py files

Postby mckryall » Tue Jan 14, 2014 2:23 am

How, in code, can I run a separate .py file without importing it's functions? Do I absolutely have to make it run a console command?
Last edited by Mekire on Tue Jan 14, 2014 6:15 am, edited 1 time in total.
Reason: Lock.
Python 2.7
Mac Mini (Desktop/server)
Macbook Air
Laptop w/ Ubuntu 14.04
Posts: 116
Joined: Sat Nov 23, 2013 6:13 pm

Re: run .py files with .py files

Postby metulburr » Tue Jan 14, 2014 3:23 am

Code: Select all

Code: Select all

Or like you said, you can have the OS call it via subprocess module.
However if the program is integrated, it would be better to import it.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
User avatar
Posts: 2120
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 6 guests