Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-10-2003, 05:41 AM   #1
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Question Python - can I import my own stuff?

I was wondering if there's a way to include another python file full of functions for my script to use without having to move it into my python modules directory. I'm after a similar effect to PHP's 'include' function.

Any help would be appreciated thanks!
Old 06-10-2003, 08:48 AM   #2
Senior Member
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
I've recently started reading a book on Python basics... I'm sure you can import your own code just like you can standard Python modules.

Did a quick Google and came up with the page...

As long as you add to Python's search path, you should be able to import your own code with...

import my_program


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
python, import and execfile() cs-cam Programming 1 10-18-2005 09:47 PM
Python: Idle: ImportError: cannot import name sleep Joe Soap Linux - Newbie 1 10-01-2005 02:52 AM
which script stuff to use? --Python ruwach Programming 4 05-27-2005 11:49 AM
Import sys ?bash: import: command not found joirnange Linux - Newbie 4 12-28-2004 11:33 PM
python: import distutils fails on debian? jpbarto Linux - Software 0 01-18-2004 11:36 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration