Oh yes it's perfectly possible! Make sure your external script is in the same folder as your main file, then just use "import example.py" (if that doesn't work remove the ".py"). Just make sure your variables can interact between the two scripts.

So import it and test it out.
Save it in python sys.path or same folder as your other .py-file.

#Check out path
>>> import sys
>>> sys.path

>>> from average import average
>>> average
<function average at 0x04D2C430>
>>> average([1,2,3,4])
2.5
>>> average(88)
'Input can only be list or tuple'
>>> average('hi')
'Input can only be list or tuple'
>>>

Am I getting this wrong or do you need to import ttk again in your new script? Also, root isn't defined in the second script. I would give you an example, but I gotta go now and I'll do it for you later :)

Right SgtMe,
That is exactly the problem. But if I import 'ttk' and create a root in
the second file (button.py) then it makes two different windows.
One with the entry in it, the other with the button.

Hmmm...now I'm thinking about it, it would be a hell of a lot easier to put all the GUI stuff in one file. I'd say that anything you had with your root (buttons, labels etc.) should all go in the one file. Then you could put your program logic in a different script. It really depends what your doing, but that is the easiest way.

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...