Is it possible to use open() and use the functions in a python file?
I tried to make a chatroom, not live of course, but I tried using the open('file.py', 'r')
function to use the functions defined in the other file. But it gave me an error. I don't know how to use functions defined in other files. I know I asked a similar question, but I want to know if I can do it with the open()
function.
koage
GAME HACKER
You want to use import function instead of opening the file
I tried, and it said there was an
@Codemonkey51AttributeError
because the modulefunction
didn't have an attributesetup_chat()
and then I tried to take thefunction.setup_chat()
and replace it withsetup_chat()
but that didn't work either.yeah
@BraylanBB121. Repl.it is having some problems with custom module importing.yeah
@sylashur. Maybe file a bug report?no problem!
@sylashur https://repl.it/bugsThank you
@PYer I appreciate the help. I guess I will have to wait until replit fixes that. I need ideas though on what to code... maybe you could suggest any?Just asking though, am I supposed to call the function like this:
@PYerfile.function(parameter)
or like this:function(parameter)
Hrmm a python bot I built fully around custom modules is working on repl
@PYerthe first, unless you import the function directley from the module.
@BraylanBB121same,
@Codemonkey51 , it seems to work for only certain things. For example, it seems to work if it is a fully developed package with an__init__.py
Mine worked with non fully developed packages
@PYerReally? Do you have explorer mode enabled or something?
@Codemonkey51