Okay, I am in the middle of creating a rather large console RPG. It'll include ability to equip armor, weapons, interacting with NPC's, battles, saving/loading characters, etc. I don't want to save all of my classes and functions in the same file, for easier readability. I have a few questions:
1) Can I import .py files that are in the same folder to a separate .py file?
2) How does this change py2exe? Do I just setup the script for the main one, or all?

Thanks in advance!

7 Years
Discussion Span
Last Post by vegaseat

Say I had two files named file_one.py and file_two.py

file_one.py looks like this:

def hello():
    print "hello"

file_two.py can import and use file_one like so:

import file_one # Notice there is no .py file extension 


The output should be a console print out of "hello". However I do not use py2exe or windows for that matter so I can not help out in that area.

Edited by ShadyTyrant: n/a


well for py2exe
just setup the script for the main py file

I'm not 100% sure, because IronPython has a compile to exe function, so I never use py2exe

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.