LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Python - can I import my own stuff? (https://www.linuxquestions.org/questions/programming-9/python-can-i-import-my-own-stuff-64713/)

miknight 06-10-2003 04:41 AM

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!

ranger_nemo 06-10-2003 07:48 AM

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...
http://aspn.activestate.com/ASPN/Pyt...tut/node8.html

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

import my_program


All times are GMT -5. The time now is 04:46 PM.