i found some advice about using the linux terminal and a command called setenv, but it says it doesn't exist. i know this is a really stupid question but i cant find an answer, sorry and thank you for any help.

If you want to prepare package called MyModules, and the parent directory is in your PATH or PYTHONPATH, then you should create an empty file called __init___.py in the directory and import the module as MyModules.polymod.

If you want to import all your modules from this directory and they are unrelated, you could add the directory to your PYTHONPATH or PATH. If you add it to your path it is simple to start the script anywhere, notice though that the current directory will then point to the directory you start the script from, not the directory of the script.

The most simple way to import stuff is not to separate the module in subdirectory, but have a directory say 'polynoms' or 'pythonprograms', which contain both the main file of the program and the modules. Then you simply CD to the directory before starting the program and importing should succeed from current directory also, so it does not need to be added to PATH or PYTHONPATH.

If you want to prepare package called MyModules, and the parent directory is in your PATH or PYTHONPATH, then you should create an empty file called __init___.py in the directory and import the module as MyModules.polymod.

If you want to import all your modules from this directory and they are unrelated, you could add the directory to your PYTHONPATH or PATH. If you add it to your path it is simple to start the script anywhere, notice though that the current directory will then point to the directory you start the script from, not the directory of the script.

The most simple way to import stuff is not to separate the module in subdirectory, but have a directory say 'polynoms' or 'pythonprograms', which contain both the main file of the program and the modules. Then you simply CD to the directory before starting the program and importing should succeed from current directory also, so it does not need to be added to PATH or PYTHONPATH.

im sorry i dont understand, could you explain, then i will try it again?

If you are in linux, your home directory contains a file named '.bashrc' (notice the dot). Type ls ~/.bashrc or ls -a ~ in a terminal to check. Then open this file with your favorite editor and add the line

export PYTHONPATH="/path/to/your/directory/MyModules"

then save the file and exit the editor, and type 'bash' in your terminal to restart the shell. If your python IDE is opened, you need to restart it as well.

If you are in linux, your home directory contains a file named '.bashrc' (notice the dot). Type ls ~/.bashrc or ls -a ~ in a terminal to check. Then open this file with your favorite editor and add the line

export PYTHONPATH="/path/to/your/directory/MyModules"

then save the file and exit the editor, and type 'bash' in your terminal to restart the shell. If your python IDE is opened, you need to restart it as well.

how do i open bashrc? i tried to in the terminal but it said permission denied?!

You may need to restart your session. If you want, you can post a part of your .bashrc to see if it's OK.

thanks for your help, when i started up today i created a new directory on my desktop with the name MyModules, worked immediately. i get the feeling there was something more t the problems i was having yesterday, the name of the directory i had My_Modules in last night doesn't come up right in the terminal and wont open when i put in the name as it appears or as it actually is, strange. but now i have a new directory and it works properly, thank you for your time.

seems i was mistaken.. i just restarted python and tried again, didn't work again?! i opened the module file and ran it, then tried import and it worked, but this is obviously not going to be of much use. i dont understand why it wont work.

thanks for your help, when i started up today i created a new directory on my desktop with the name MyModules, worked immediately. i get the feeling there was something more t the problems i was having yesterday, the name of the directory i had My_Modules in last night doesn't come up right in the terminal and wont open when i put in the name as it appears or as it actually is, strange. but now i have a new directory and it works properly, thank you for your time.

seems i was mistaken.. i just restarted python and tried again, didn't work again?! i opened the module file and ran it, then tried import and it worked, but this is obviously not going to be of much use. i dont understand why it wont work.

It's impossible, the PYTHONPATH must work. Can you post your ~/.bashrc ?