0

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!

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by vegaseat
Featured Replies
  • Say I had two files named file_one.py and file_two.py file_one.py looks like this: [CODE] def hello(): print "hello" [/CODE] file_two.py can import and use file_one like so: [CODE] import file_one # Notice there is no .py file extension file_one.hello() [/CODE] The output should be a console print out of "hello". … Read More

1

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 

file_one.hello()

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

0

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.
Please be thoughtful and detailed and be sure to adhere to our posting rules.