Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Custom Module
-
Is it possible to program a module? Or even import it?
If so, how? -
- Put your code into a module called
reefrunner
(Pythonista will add the.py
for you). - In your main program add the line:
import reefrunner ; reload(reefrunner)
. - In your main program you can now use classes, functions, and variables defined in reefrunner.
The
reload()
command above is strongly advised for modules that you are editing to ensure that Pythonista is always using the latest and greatest code. - Put your code into a module called
-
Thank you very much
-
I get an error that says no module named reefrunner
-
Never mind I figured it out
-
Ok another question.
import ReefRunner ; reload(ReefRunner) gac = raw_input(' ') def graphics(): gbox=''' |-------------------| | | | | | | | | |___________________| ''' if gac == 'graphics.gbox()': print(gbox) else: print('The Text You Entered Is Not Compatible With This Module')
It says gbox is not defined. What do I do?
-
In your code above, the scope of
gbox
is only inside of the functiongraphics()
.If you indent the
if
statement to be inside of the functiongraphics()
, and you callgraphics()
, it should work. -
Thanks! Your super helpful! Are you like a moderator?
-
-
I indented the if statment. But now it won't even print the box. I get no errors
-
You must call
graphics()
to run its code. -
How do I call graphixs()
-
See the last line:
import ReefRunner ; reload(ReefRunner) gac = raw_input('Type "grapics()" or not.: ').lower() def graphics(): gbox=''' |-------------------| | | | | | | | | |___________________| ''' if gac == 'graphics()': print(gbox) else: print('The Text You Entered Is Not Compatible With This Module') graphics() # here we are calling graphics() to run the code of that function
-
Ok thanks. Sorry that was a noob question